2011-11-13 13:56:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# encoding: utf-8 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# Redmine - project management software 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 18:09:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# Copyright (C) 2006-2011  Jean-Philippe Lang 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# 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. 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# 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. 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# 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. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-10-27 11:08:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								require  'forwardable' 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-12 16:01:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								require  'cgi' 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-09 18:40:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								module  ApplicationHelper 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-12 14:36:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  include  Redmine :: WikiFormatting :: Macros :: Definitions 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-21 11:04:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  include  Redmine :: I18n 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-09 14:52:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  include  GravatarHelper :: PublicMethods 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-10-27 11:08:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  extend  Forwardable 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def_delegators  :wiki_helper ,  :wikitoolbar_for ,  :heads_for_wiki_formatter 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Return true if user is authorized for controller/action, otherwise false 
							 
						 
					
						
							
								
									
										
										
										
											2007-08-29 16:52:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  authorize_for ( controller ,  action ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    User . current . allowed_to? ( { :controller  = >  controller ,  :action  = >  action } ,  @project ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Display a link if user is authorized 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-06 00:26:08 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # @param [String] name Anchor text (passed to link_to) 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 23:11:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # @param [Hash] options Hash params. This will checked by authorize_for to see if the user is authorized 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-06 00:26:08 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # @param [optional, Hash] html_options Options passed to link_to 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # @param [optional, Hash] parameters_for_method_reference Extra parameters for link_to 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  link_to_if_authorized ( name ,  options  =  { } ,  html_options  =  nil ,  * parameters_for_method_reference ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 23:11:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to ( name ,  options ,  html_options ,  * parameters_for_method_reference )  if  authorize_for ( options [ :controller ]  ||  params [ :controller ] ,  options [ :action ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-28 18:56:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-08-28 18:56:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Display a link to remote if user is authorized 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  link_to_remote_if_authorized ( name ,  options  =  { } ,  html_options  =  nil ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    url  =  options [ :url ]  ||  { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    link_to_remote ( name ,  options ,  html_options )  if  authorize_for ( url [ :controller ]  ||  params [ :controller ] ,  url [ :action ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 10:48:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Displays a link to user's account page if active 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-07 13:12:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  link_to_user ( user ,  options = { } ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 08:36:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  user . is_a? ( User ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 10:48:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      name  =  h ( user . name ( options [ :format ] ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  user . active? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        link_to  name ,  :controller  = >  'users' ,  :action  = >  'show' ,  :id  = >  user 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 08:36:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 10:48:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      h ( user . to_s ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 08:36:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-14 12:53:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Displays a link to +issue+ with its subject. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Examples: 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-14 12:53:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  #   link_to_issue(issue)                        # => Defect #6: This is the subject 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   link_to_issue(issue, :truncate => 6)        # => Defect #6: This i... 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   link_to_issue(issue, :subject => false)     # => Defect #6 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-12 15:33:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  #   link_to_issue(issue, :project => true)      # => Foo - Defect #6 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-14 12:53:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-16 12:21:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  link_to_issue ( issue ,  options = { } ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-14 12:53:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    title  =  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    subject  =  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  options [ :subject ]  ==  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      title  =  truncate ( issue . subject ,  :length  = >  60 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      subject  =  issue . subject 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  options [ :truncate ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        subject  =  truncate ( subject ,  :length  = >  options [ :truncate ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-29 23:20:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    s  =  link_to  " #{ h ( issue . tracker ) }   # #{ issue . id } " ,  { :controller  = >  " issues " ,  :action  = >  " show " ,  :id  = >  issue } , 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-14 12:53:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                                 :class  = >  issue . css_classes , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                 :title  = >  title 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-02 17:40:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    s  <<  h ( " :  #{ subject } " )  if  subject 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    s  =  h ( " #{ issue . project }  -  " )  +  s  if  options [ :project ] 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-14 12:53:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    s 
							 
						 
					
						
							
								
									
										
										
										
											2007-04-07 18:30:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-22 17:55:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Generates a link to an attachment. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Options: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # * :text - Link text (default to attachment filename) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # * :download - Force download (default: false) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  link_to_attachment ( attachment ,  options = { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    text  =  options . delete ( :text )  ||  attachment . filename 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    action  =  options . delete ( :download )  ?  'download'  :  'show' 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-06 05:45:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    opt_only_path  =  { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    opt_only_path [ :only_path ]  =  ( options [ :only_path ]  ==  false  ?  false  :  true ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-06 06:07:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    options . delete ( :only_path ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 00:10:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to ( h ( text ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								           { :controller  = >  'attachments' ,  :action  = >  action , 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-06 05:45:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            :id  = >  attachment ,  :filename  = >  attachment . filename } . merge ( opt_only_path ) , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 00:10:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								           options ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-22 17:55:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-22 23:23:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Generates a link to a SCM revision 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Options: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # * :text - Link text (default to the formatted revision) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-15 18:19:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  link_to_revision ( revision ,  repository ,  options = { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  repository . is_a? ( Project ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      repository  =  repository . repository 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-22 23:23:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    text  =  options . delete ( :text )  ||  format_revision ( revision ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 09:45:05 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    rev  =  revision . respond_to? ( :identifier )  ?  revision . identifier  :  revision 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-03 06:14:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        h ( text ) , 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-15 18:19:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { :controller  = >  'repositories' ,  :action  = >  'revision' ,  :id  = >  repository . project ,  :repository_id  = >  repository . identifier_param ,  :rev  = >  rev } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-03 06:14:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        :title  = >  l ( :label_revision_id ,  format_revision ( revision ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-22 23:23:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 17:02:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Generates a link to a message 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  link_to_message ( message ,  options = { } ,  html_options  =  nil ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    link_to ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      h ( truncate ( message . subject ,  :length  = >  60 ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      {  :controller  = >  'messages' ,  :action  = >  'show' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        :board_id  = >  message . board_id , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        :id  = >  message . root , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        :r  = >  ( message . parent_id  &&  message . id ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        :anchor  = >  ( message . parent_id  ?  " message- #{ message . id } "  :  nil ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      } . merge ( options ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      html_options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-22 23:23:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-08 07:07:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Generates a link to a project if active 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Examples: 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-08 07:07:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  #   link_to_project(project)                          # => link to the specified project overview 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   link_to_project(project, :action=>'settings')     # => link to project settings 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   link_to_project(project, {:only_path => false}, :class => "project") # => 3rd arg adds html options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   link_to_project(project, {}, :class => "project") # => html options with default url (project overview) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  link_to_project ( project ,  options = { } ,  html_options  =  nil ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  project . active? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      url  =  { :controller  = >  'projects' ,  :action  = >  'show' ,  :id  = >  project } . merge ( options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      link_to ( h ( project ) ,  url ,  html_options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      h ( project ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-04-07 18:56:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  toggle_link ( name ,  id ,  options = { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    onclick  =  " Element.toggle(' #{ id } ');  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    onclick  <<  ( options [ :focus ]  ?  " Form.Element.focus(' #{ options [ :focus ] } ');  "  :  " this.blur();  " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    onclick  <<  " return false; " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    link_to ( name ,  " # " ,  :onclick  = >  onclick ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  image_to_function ( name ,  function ,  html_options  =  { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    html_options . symbolize_keys! 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    tag ( :input ,  html_options . merge ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        :type  = >  " image " ,  :src  = >  image_path ( name ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        :onclick  = >  ( html_options [ :onclick ]  ?  " #{ html_options [ :onclick ] } ;  "  :  " " )  +  " #{ function } ; " 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-08-16 16:45:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  prompt_to_remote ( name ,  text ,  param ,  url ,  html_options  =  { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    html_options [ :onclick ]  =  " promptToRemote(' #{ text } ', ' #{ param } ', ' #{ url_for ( url ) } '); return false; " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    link_to  name ,  { } ,  html_options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-11-30 11:18:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  format_activity_title ( text ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-21 11:04:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    h ( truncate_single_line ( text ,  :length  = >  100 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-30 11:18:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-11-30 11:18:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  format_activity_day ( date ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    date  ==  Date . today  ?  l ( :label_today ) . titleize  :  format_date ( date ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-11-30 11:18:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  format_activity_description ( text ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-03 06:15:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    h ( truncate ( text . to_s ,  :length  = >  120 ) . gsub ( %r{ [ \ r \ n]*<(pre|code)>.*$ }m ,  '...' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								       ) . gsub ( / [ \ r \ n]+ / ,  " <br /> " ) . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2008-09-20 14:07:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-06 10:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  format_version_name ( version ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  version . project  ==  @project 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    	h ( version ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      h ( " #{ version . project }  -  #{ version } " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-09-20 14:07:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  due_date_distance_in_words ( date ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  date 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      l ( ( date  <  Date . today  ?  :label_roadmap_overdue  :  :label_roadmap_due_in ) ,  distance_of_date_in_words ( Date . today ,  date ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 18:27:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  render_page_hierarchy ( pages ,  node = nil ,  options = { } ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-22 11:44:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    content  =  '' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  pages [ node ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      content  <<  " <ul class= \" pages-hierarchy \" > \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      pages [ node ] . each  do  | page | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        content  <<  " <li> " 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-27 16:27:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        content  <<  link_to ( h ( page . pretty_title ) ,  { :controller  = >  'wiki' ,  :action  = >  'show' ,  :project_id  = >  page . project ,  :id  = >  page . title } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-12 18:27:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                           :title  = >  ( options [ :timestamp ]  &&  page . updated_on  ?  l ( :label_updated_time ,  distance_of_time_in_words ( Time . now ,  page . updated_on ) )  :  nil ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        content  <<  " \n "  +  render_page_hierarchy ( pages ,  page . id ,  options )  if  pages [ page . id ] 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-22 11:44:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        content  <<  " </li> \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      content  <<  " </ul> \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-06 11:03:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    content . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-22 11:44:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-03 14:11:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Renders flash messages 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  render_flash_messages 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    s  =  '' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    flash . each  do  | k , v | 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 08:25:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      s  <<  content_tag ( 'div' ,  v . html_safe ,  :class  = >  " flash  #{ k } " ,  :id  = >  " flash_ #{ k } " ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-03 14:11:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 10:51:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    s . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-03 14:11:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 09:13:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Renders tabs and their content 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  render_tabs ( tabs ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  tabs . any? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      render  :partial  = >  'common/tabs' ,  :locals  = >  { :tabs  = >  tabs } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      content_tag  'p' ,  l ( :label_no_data ) ,  :class  = >  " nodata " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Renders the project quick-jump box 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  render_project_jump_box 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-14 16:32:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  unless  User . current . logged? 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    projects  =  User . current . memberships . collect ( & :project ) . compact . uniq 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  projects . any? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      s  =  '<select onchange="if (this.value != \'\') { window.location = this.value; }">'  + 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-24 11:29:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            " <option value=''> #{  l ( :label_jump_to_a_project )  } </option> "  + 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-11 08:20:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            '<option value="" disabled="disabled">---</option>' 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-24 11:29:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      s  <<  project_tree_options_for_select ( projects ,  :selected  = >  @project )  do  | p | 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-25 12:13:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        {  :value  = >  url_for ( :controller  = >  'projects' ,  :action  = >  'show' ,  :id  = >  p ,  :jump  = >  current_menu_item )  } 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      s  <<  '</select>' 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 10:52:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      s . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  project_tree_options_for_select ( projects ,  options  =  { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    s  =  '' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    project_tree ( projects )  do  | project ,  level | 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-26 07:10:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      name_prefix  =  ( level  >  0  ?  ( ' '  *  2  *  level  +  '» ' ) . html_safe  :  '' ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-03 03:37:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      tag_options  =  { :value  = >  project . id } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  project  ==  options [ :selected ]  ||  ( options [ :selected ] . respond_to? ( :include? )  &&  options [ :selected ] . include? ( project ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        tag_options [ :selected ]  =  'selected' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        tag_options [ :selected ]  =  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      tag_options . merge! ( yield ( project ) )  if  block_given? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      s  <<  content_tag ( 'option' ,  name_prefix  +  h ( project ) ,  tag_options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 10:52:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    s . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Yields the given block for each project with its level in the tree 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-22 22:38:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Wrapper for Project#project_tree 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  project_tree ( projects ,  & block ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-22 22:38:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    Project . project_tree ( projects ,  & block ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-24 11:31:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 14:22:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  project_nested_ul ( projects ,  & block ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    s  =  '' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  projects . any? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ancestors  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      projects . sort_by ( & :lft ) . each  do  | project | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  ( ancestors . empty?  ||  project . is_descendant_of? ( ancestors . last ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          s  <<  " <ul> \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          ancestors . pop 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          s  <<  " </li> " 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          while  ( ancestors . any?  &&  ! project . is_descendant_of? ( ancestors . last ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 14:22:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            ancestors . pop 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            s  <<  " </ul></li> \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        s  <<  " <li> " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        s  <<  yield ( project ) . to_s 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ancestors  <<  project 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      s  <<  ( " </li></ul> \n "  *  ancestors . size ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 10:53:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    s . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 14:22:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 08:36:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  principals_check_box_tags ( name ,  principals ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    s  =  '' 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 11:17:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    principals . sort . each  do  | principal | 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 08:36:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      s  <<  " <label> #{  check_box_tag  name ,  principal . id ,  false  }   #{ h  principal } </label> \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 10:53:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    s . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 08:36:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 05:57:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-23 19:05:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Returns a string for users/groups option tags 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  principals_options_for_select ( collection ,  selected = nil ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    s  =  '' 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-21 11:06:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  collection . include? ( User . current ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      s  <<  content_tag ( 'option' ,  " <<  #{ l ( :label_me ) }  >> " . html_safe ,  :value  = >  User . current . id ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-21 11:06:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-23 19:05:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    groups  =  '' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    collection . sort . each  do  | element | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      selected_attribute  =  ' selected="selected"'  if  option_value_selected? ( element ,  selected ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ( element . is_a? ( Group )  ?  groups  :  s )  <<  %( <option value=" #{ element . id } " #{ selected_attribute } > #{ h  element . name } </option> ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    unless  groups . empty? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      s  <<  %( <optgroup label=" #{ h ( l ( :label_group_plural ) ) } "> #{ groups } </optgroup> ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-21 01:44:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    s . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-23 19:05:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-22 11:44:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-04 18:13:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Truncates and returns the string as a single line 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  truncate_single_line ( string ,  * args ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 17:55:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    truncate ( string . to_s ,  * args ) . gsub ( %r{ [ \ r \ n]+ }m ,  ' ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-04 18:13:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-18 20:02:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Truncates at line break after 250 characters or options[:length] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  truncate_lines ( string ,  options = { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    length  =  options [ :length ]  ||  250 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  string . to_s  =~  / \ A(.{ #{ length } }.*?)$ /m 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      " #{ $1 } ... " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      string 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-08 17:14:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  anchor ( text ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    text . to_s . gsub ( ' ' ,  '_' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-02-26 18:15:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  html_hours ( text ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 10:54:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    text . gsub ( %r{ ( \ d+) \ .( \ d+) } ,  '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>' ) . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-26 18:15:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-06 11:21:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  authoring ( created ,  author ,  options = { } ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 10:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    l ( options [ :label ]  ||  :label_added_time_by ,  :author  = >  link_to_user ( author ) ,  :age  = >  time_tag ( created ) ) . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-04 12:36:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-04 12:36:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  time_tag ( time ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    text  =  distance_of_time_in_words ( Time . now ,  time ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  @project 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-16 21:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      link_to ( text ,  { :controller  = >  'activities' ,  :action  = >  'index' ,  :id  = >  @project ,  :from  = >  time . to_date } ,  :title  = >  format_time ( time ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-04 12:36:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      content_tag ( 'acronym' ,  text ,  :title  = >  format_time ( time ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 06:01:48 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  syntax_highlight_lines ( name ,  content ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    lines  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    syntax_highlight ( name ,  content ) . each_line  {  | line |  lines  <<  line  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    lines 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-09 18:40:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  syntax_highlight ( name ,  content ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-14 12:57:08 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    Redmine :: SyntaxHighlighting . highlight_by_filename ( content ,  name ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-09 18:40:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-07-06 12:43:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  to_path_param ( path ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-02 13:19:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    str  =  path . to_s . split ( %r{ [/ \\ ] } ) . select { | p |  ! p . blank? } . join ( " / " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    str . blank?  ?  nil  :  str 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-06 12:43:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-12-29 11:36:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  pagination_links_full ( paginator ,  count = nil ,  options = { } ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-06-23 18:53:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    page_param  =  options . delete ( :page_param )  ||  :page 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-06 12:54:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    per_page_links  =  options . delete ( :per_page_links ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-29 11:36:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    url_param  =  params . dup 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    html  =  '' 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-26 01:47:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  paginator . current . previous 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-06 00:49:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      # \xc2\xab(utf-8) = « 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      html  <<  link_to_content_update ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                   " \xc2 \xab   "  +  l ( :label_previous ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                   url_param . merge ( page_param  = >  paginator . current . previous ) )  +  ' ' 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-26 01:47:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    html  <<  ( pagination_links_each ( paginator ,  options )  do  | n | 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-03 14:01:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      link_to_content_update ( n . to_s ,  url_param . merge ( page_param  = >  n ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end  ||  '' ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-26 01:47:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  paginator . current . next 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-06 00:49:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      # \xc2\xbb(utf-8) = » 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      html  <<  ' '  +  link_to_content_update ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                      ( l ( :label_next )  +  "   \xc2 \xbb " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                      url_param . merge ( page_param  = >  paginator . current . next ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-26 01:47:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-12-29 11:36:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    unless  count . nil? 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-06 12:54:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      html  <<  "  ( #{ paginator . current . first_item } - #{ paginator . current . last_item } / #{ count } ) " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  per_page_links  !=  false  &&  links  =  per_page_links ( paginator . items_per_page ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									      html  <<  "  |  #{ links } " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-29 11:36:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 10:55:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    html . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-12-29 11:36:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  per_page_links ( selected = nil ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    links  =  Setting . per_page_options_array . collect  do  | n | 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-03 14:01:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      n  ==  selected  ?  n  :  link_to_content_update ( n ,  params . merge ( :per_page  = >  n ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-29 11:36:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    links . size  >  1  ?  l ( :label_display_per_page ,  links . join ( ', ' ) )  :  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-22 21:32:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  reorder_links ( name ,  url ,  method  =  :post ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-06 11:04:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to ( image_tag ( '2uparrow.png' ,  :alt  = >  l ( :label_sort_highest ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            url . merge ( { " #{ name } [move_to] "  = >  'highest' } ) , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-22 21:32:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            :method  = >  method ,  :title  = >  l ( :label_sort_highest ) )  + 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-06 11:04:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to ( image_tag ( '1uparrow.png' ,    :alt  = >  l ( :label_sort_higher ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            url . merge ( { " #{ name } [move_to] "  = >  'higher' } ) , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-22 21:32:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								           :method  = >  method ,  :title  = >  l ( :label_sort_higher ) )  + 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-06 11:04:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to ( image_tag ( '1downarrow.png' ,  :alt  = >  l ( :label_sort_lower ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            url . merge ( { " #{ name } [move_to] "  = >  'lower' } ) , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-22 21:32:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            :method  = >  method ,  :title  = >  l ( :label_sort_lower ) )  + 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-06 11:04:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to ( image_tag ( '2downarrow.png' ,  :alt  = >  l ( :label_sort_lowest ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            url . merge ( { " #{ name } [move_to] "  = >  'lowest' } ) , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-22 21:32:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								           :method  = >  method ,  :title  = >  l ( :label_sort_lowest ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-26 09:21:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-03-27 18:41:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  breadcrumb ( * args ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-26 11:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    elements  =  args . flatten 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-21 11:11:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    elements . any?  ?  content_tag ( 'p' ,  ( args . join ( "   \xc2 \xbb   " )  +  "   \xc2 \xbb   " ) . html_safe ,  :class  = >  'breadcrumb' )  :  nil 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-27 18:41:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 13:53:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  other_formats_links ( & block ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-22 20:57:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    concat ( '<p class="other-formats">' . html_safe  +  l ( :label_export_to ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 13:53:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    yield  Redmine :: Views :: OtherFormatsBuilder . new ( self ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-22 20:57:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    concat ( '</p>' . html_safe ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-29 13:53:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-20 18:34:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  page_header_title 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  @project . nil?  ||  @project . new_record? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      h ( Setting . app_title ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      b  =  [ ] 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-14 16:29:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ancestors  =  ( @project . root?  ?  [ ]  :  @project . ancestors . visible . all ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-20 18:34:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      if  ancestors . any? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        root  =  ancestors . shift 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-08 07:07:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        b  <<  link_to_project ( root ,  { :jump  = >  current_menu_item } ,  :class  = >  'root' ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-20 18:34:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ancestors . size  >  2 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-06 11:02:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          b  <<  " \xe2 \x80 \xa6 " 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-20 18:34:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          ancestors  =  ancestors [ - 2 ,  2 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-08 07:07:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        b  +=  ancestors . collect  { | p |  link_to_project ( p ,  { :jump  = >  current_menu_item } ,  :class  = >  'ancestor' )  } 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-20 18:34:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      b  <<  h ( @project ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-06 15:02:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      b . join ( "   \xc2 \xbb   " ) . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-20 18:34:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-01-02 22:41:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  html_title ( * args ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  args . empty? 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-19 11:43:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      title  =  @html_title  ||  [ ] 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-16 01:50:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      title  <<  @project . name  if  @project 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-19 11:43:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      title  <<  Setting . app_title  unless  Setting . app_title  ==  title . last 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-24 12:33:08 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      title . select  { | t |  ! t . blank?  } . join ( ' - ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-02 22:41:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      @html_title  || =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      @html_title  +=  args 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-07 20:52:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2007-10-05 18:05:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-04 01:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Returns the theme, controller name, and action as css classes for the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # HTML body. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  body_css_classes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    css  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  theme  =  Redmine :: Themes . theme ( Setting . ui_theme ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      css  <<  'theme-'  +  theme . name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-26 19:20:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    css  <<  'controller-'  +  controller_name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    css  <<  'action-'  +  action_name 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-04 01:17:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    css . join ( ' ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-10-05 18:05:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  accesskey ( s ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-20 13:07:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    Redmine :: AccessKeys . key_for  s 
							 
						 
					
						
							
								
									
										
										
										
											2007-10-05 18:05:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-11-12 14:36:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Formats text according to system settings. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # 2 ways to call this method: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # * with a String: textilizable(text, options) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # * with an object and one of its attribute: textilizable(issue, :description, options) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  textilizable ( * args ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    options  =  args . last . is_a? ( Hash )  ?  args . pop  :  { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    case  args . size 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    when  1 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-26 12:54:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      obj  =  options [ :object ] 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-17 14:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      text  =  args . shift 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-12 14:36:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    when  2 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      obj  =  args . shift 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-06 10:40:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      attr  =  args . shift 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      text  =  obj . send ( attr ) . to_s 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-12 14:36:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      raise  ArgumentError ,  'invalid arguments to textilizable' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-17 14:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  ''  if  text . blank? 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    project  =  options [ :project ]  ||  @project  ||  ( obj  &&  obj . respond_to? ( :project )  ?  obj . project  :  nil ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    only_path  =  options . delete ( :only_path )  ==  false  ?  false  :  true 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 16:25:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    text  =  Redmine :: WikiFormatting . to_html ( Setting . text_formatting ,  text ,  :object  = >  obj ,  :attribute  = >  attr ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    @parsed_headings  =  [ ] 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 08:09:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    @heading_anchors  =  { } 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 18:22:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    @current_section  =  0  if  options [ :edit_section_links ] 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-11 10:02:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parse_sections ( text ,  project ,  obj ,  attr ,  only_path ,  options ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    text  =  parse_non_pre_blocks ( text )  do  | text | 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-11 10:02:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      [ :parse_inline_attachments ,  :parse_wiki_links ,  :parse_redmine_links ,  :parse_macros ] . each  do  | method_name | 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:54:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        send  method_name ,  text ,  project ,  obj ,  attr ,  only_path ,  options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-11 10:02:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    parse_headings ( text ,  project ,  obj ,  attr ,  only_path ,  options ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  @parsed_headings . any? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      replace_toc ( text ,  @parsed_headings ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-17 22:15:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    text . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:54:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:54:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  parse_non_pre_blocks ( text ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    s  =  StringScanner . new ( text ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    tags  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    parsed  =  '' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    while  ! s . eos? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      s . scan ( / (.*?)(<( \/ )?(pre|code)(.*?)>| \ z) /im ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      text ,  full_tag ,  closing ,  tag  =  s [ 1 ] ,  s [ 2 ] ,  s [ 3 ] ,  s [ 4 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  tags . empty? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        yield  text 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      parsed  <<  text 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  tag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  closing 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          if  tags . last  ==  tag . downcase 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            tags . pop 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          tags  <<  tag . downcase 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        parsed  <<  full_tag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:57:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    # Close any non closing tags 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    while  tag  =  tags . pop 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      parsed  <<  " </ #{ tag } > " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    parsed 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  parse_inline_attachments ( text ,  project ,  obj ,  attr ,  only_path ,  options ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-02 20:41:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    # when using an image link, try to use an attachment, if possible 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-14 08:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  options [ :attachments ]  ||  ( obj  &&  obj . respond_to? ( :attachments ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 05:31:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      attachments  =  options [ :attachments ]  ||  obj . attachments 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-23 05:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      text . gsub! ( / src="([^ \/ "]+ \ .(bmp|gif|jpg|jpe|jpeg|png))"( \ s+alt="([^"]*)")? /i )  do  | m | 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        filename ,  ext ,  alt ,  alttext  =  $1 . downcase ,  $2 ,  $3 ,  $4 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-02 20:41:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        # search for the picture in attachments 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 05:31:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  found  =  Attachment . latest_attach ( attachments ,  filename ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          image_url  =  url_for  :only_path  = >  only_path ,  :controller  = >  'attachments' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                              :action  = >  'download' ,  :id  = >  found 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-27 10:52:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          desc  =  found . description . to_s . gsub ( '"' ,  '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          if  ! desc . blank?  &&  alttext . blank? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            alt  =  "  title= \" #{ desc } \"  alt= \" #{ desc } \" " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          " src= \" #{ image_url } \" #{ alt } " 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-02 20:41:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          m 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-02 20:41:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Wiki links 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Examples: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   [[mypage]] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   [[mypage|mytext]] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # wiki links can refer other project wikis, using project name or identifier: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   [[project:]] -> wiki starting page 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   [[project:|mytext]] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   [[project:mypage]] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   [[project:mypage|mytext]] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  parse_wiki_links ( text ,  project ,  obj ,  attr ,  only_path ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    text . gsub! ( / (!)?( \ [ \ [([^ \ ] \ n \ |]+)( \ |([^ \ ] \ n \ |]+))? \ ] \ ]) / )  do  | m | 
							 
						 
					
						
							
								
									
										
										
										
											2007-08-17 11:21:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      link_project  =  project 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      esc ,  all ,  page ,  title  =  $1 ,  $2 ,  $3 ,  $5 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  esc . nil? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  page  =~  / ^([^ \ :]+) \ :(.*)$ / 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-11 13:39:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          link_project  =  Project . find_by_identifier ( $1 )  ||  Project . find_by_name ( $1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          page  =  $2 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          title  || =  $1  if  page . blank? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  link_project  &&  link_project . wiki 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-28 17:20:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          # extract anchor 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          anchor  =  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          if  page  =~  / ^(.+?) \ # (.+)$ / 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            page ,  anchor  =  $1 ,  $2 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 17:25:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          anchor  =  sanitize_anchor_name ( anchor )  if  anchor . present? 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          # check if page exists 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          wiki_page  =  link_project . wiki . find_page ( page ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 14:44:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          url  =  if  anchor . present?  &&  wiki_page . present?  &&  ( obj . is_a? ( WikiContent )  ||  obj . is_a? ( WikiContent :: Version ) )  &&  obj . page  ==  wiki_page 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            " # #{ anchor } " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            case  options [ :wiki_links ] 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 15:32:34 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            when  :local ;  " #{ page . present?  ?  Wiki . titleize ( page )  :  '' } .html "  +  ( anchor . present?  ?  " # #{ anchor } "  :  '' ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 15:57:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            when  :anchor ;  " # #{ page . present?  ?  Wiki . titleize ( page )  :  title } "  +  ( anchor . present?  ?  " _ #{ anchor } "  :  '' )  # used for single-file wiki export 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            else 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-28 21:25:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              wiki_page_id  =  page . present?  ?  Wiki . titleize ( page )  :  nil 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-17 11:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              parent  =  wiki_page . nil?  &&  obj . is_a? ( WikiContent )  &&  obj . page  &&  project  ==  link_project  ?  obj . page . title  :  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              url_for ( :only_path  = >  only_path ,  :controller  = >  'wiki' ,  :action  = >  'show' ,  :project_id  = >  link_project ,  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								               :id  = >  wiki_page_id ,  :anchor  = >  anchor ,  :parent  = >  parent ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 14:44:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 19:47:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          link_to ( title . present?  ?  title . html_safe  :  h ( page ) ,  url ,  :class  = >  ( 'wiki-page'  +  ( wiki_page  ?  ''  :  ' new' ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          # project or wiki doesn't exist 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          all 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-07 20:07:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      else 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        all 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-07 20:07:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2007-08-15 17:31:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Redmine links 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Examples: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   Issues: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     #52 -> Link to issue #52 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   Changesets: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     r52 -> Link to revision 52 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     commit:a85130f -> Link to scmid starting with a85130f 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   Documents: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     document#17 -> Link to document with id 17 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     document:Greetings -> Link to the document with title "Greetings" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     document:"Some document" -> Link to the document with title "Some document" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   Versions: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     version#3 -> Link to version with id 3 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     version:1.0.0 -> Link to version named "1.0.0" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     version:"1.0 beta 2" -> Link to version named "1.0 beta 2" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   Attachments: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     attachment:file.zip -> Link to the attachment of the current object named file.zip 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   Source files: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     source:some/file -> Link to the file located at /some/file in the project's repository 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     source:some/file@52 -> Link to the file's revision 52 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     source:some/file#L120 -> Link to line 120 of the file 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     source:some/file@52#L120 -> Link to line 120 of the file's revision 52 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     export:some/file -> Force the download of the file 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 16:12:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  #   Forum messages: 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  #     message#1218 -> Link to message with id 1218 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 16:12:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   Links can refer other objects from other projects, using project identifier: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     identifier:r52 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     identifier:document:"Some document" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     identifier:version:1.0.0 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #     identifier:source:some/file 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-15 19:37:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  parse_redmine_links ( text ,  project ,  obj ,  attr ,  only_path ,  options ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-15 17:49:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    text . gsub! ( %r{ ([ \ s \ (, \ - \ [ \ >]|^)(!)?(([a-z0-9 \ -_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?((( # )|((([a-z0-9 \ -]+) \ |)?(r)))(( \ d+)(( # note)?-( \ d+))?)|(:)([^" \ s<>][^ \ s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,| \ s| \ ]|<|$) } )  do  | m | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      leading ,  esc ,  project_prefix ,  project_identifier ,  prefix ,  repo_prefix ,  repo_identifier ,  sep ,  identifier ,  comment_suffix ,  comment_id  =  $1 ,  $2 ,  $3 ,  $4 ,  $5 ,  $10 ,  $11 ,  $8  ||  $12  ||  $18 ,  $14  ||  $19 ,  $15 ,  $17 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-02 20:41:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      link  =  nil 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 16:12:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      if  project_identifier 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        project  =  Project . visible . find_by_identifier ( project_identifier ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      if  esc . nil? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  prefix . nil?  &&  sep  ==  'r' 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 14:23:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          if  project 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            repository  =  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  repo_identifier 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              repository  =  project . repositories . detect  { | repo |  repo . identifier  ==  repo_identifier } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              repository  =  project . repository 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            # project.changesets.visible raises an SQL error because of a double join on repositories 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  repository  &&  ( changeset  =  Changeset . visible . find_by_repository_id_and_revision ( repository . id ,  identifier ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              link  =  link_to ( h ( " #{ project_prefix } #{ repo_prefix } r #{ identifier } " ) ,  { :only_path  = >  only_path ,  :controller  = >  'repositories' ,  :action  = >  'revision' ,  :id  = >  project ,  :repository_id  = >  repository . identifier_param ,  :rev  = >  changeset . revision } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                        :class  = >  'changeset' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                        :title  = >  truncate_single_line ( changeset . comments ,  :length  = >  100 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        elsif  sep  ==  '#' 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-18 18:53:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          oid  =  identifier . to_i 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          case  prefix 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          when  nil 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-14 12:08:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  issue  =  Issue . visible . find_by_id ( oid ,  :include  = >  :status ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-15 17:49:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              anchor  =  comment_id  ?  " note- #{ comment_id } "  :  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              link  =  link_to ( " # #{ oid } " ,  { :only_path  = >  only_path ,  :controller  = >  'issues' ,  :action  = >  'show' ,  :id  = >  oid ,  :anchor  = >  anchor } , 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-14 12:59:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                        :class  = >  issue . css_classes , 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-21 11:04:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                        :title  = >  " #{ truncate ( issue . subject ,  :length  = >  100 ) }  ( #{ issue . status . name } ) " ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          when  'document' 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 16:47:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  document  =  Document . visible . find_by_id ( oid ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-17 14:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( document . title ) ,  { :only_path  = >  only_path ,  :controller  = >  'documents' ,  :action  = >  'show' ,  :id  = >  document } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                :class  = >  'document' 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          when  'version' 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 16:47:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  version  =  Version . visible . find_by_id ( oid ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-17 14:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( version . name ) ,  { :only_path  = >  only_path ,  :controller  = >  'versions' ,  :action  = >  'show' ,  :id  = >  version } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                              :class  = >  'version' 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-10 22:18:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          when  'message' 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 16:47:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  message  =  Message . visible . find_by_id ( oid ,  :include  = >  :parent ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 17:02:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              link  =  link_to_message ( message ,  { :only_path  = >  only_path } ,  :class  = >  'message' ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-08-10 22:18:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-19 11:16:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          when  'forum' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  board  =  Board . visible . find_by_id ( oid ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( board . name ) ,  { :only_path  = >  only_path ,  :controller  = >  'boards' ,  :action  = >  'show' ,  :id  = >  board ,  :project_id  = >  board . project } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                             :class  = >  'board' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          when  'news' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  news  =  News . visible . find_by_id ( oid ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( news . title ) ,  { :only_path  = >  only_path ,  :controller  = >  'news' ,  :action  = >  'show' ,  :id  = >  news } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                            :class  = >  'news' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-13 10:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          when  'project' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  p  =  Project . visible . find_by_id ( oid ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-08 07:07:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              link  =  link_to_project ( p ,  { :only_path  = >  only_path } ,  :class  = >  'project' ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-13 10:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        elsif  sep  ==  ':' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          # removes the double quotes if any 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-18 18:53:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          name  =  identifier . gsub ( %r{ ^"(.*)"$ } ,  " \\ 1 " ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          case  prefix 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          when  'document' 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 16:47:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  project  &&  document  =  project . documents . visible . find_by_title ( name ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-17 14:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( document . title ) ,  { :only_path  = >  only_path ,  :controller  = >  'documents' ,  :action  = >  'show' ,  :id  = >  document } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                :class  = >  'document' 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          when  'version' 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-23 16:47:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  project  &&  version  =  project . versions . visible . find_by_name ( name ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-17 14:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( version . name ) ,  { :only_path  = >  only_path ,  :controller  = >  'versions' ,  :action  = >  'show' ,  :id  = >  version } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                              :class  = >  'version' 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-19 11:16:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          when  'forum' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  project  &&  board  =  project . boards . visible . find_by_name ( name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( board . name ) ,  { :only_path  = >  only_path ,  :controller  = >  'boards' ,  :action  = >  'show' ,  :id  = >  board ,  :project_id  = >  board . project } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                             :class  = >  'board' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          when  'news' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  project  &&  news  =  project . news . visible . find_by_title ( name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( news . title ) ,  { :only_path  = >  only_path ,  :controller  = >  'news' ,  :action  = >  'show' ,  :id  = >  news } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                            :class  = >  'news' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 14:23:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          when  'commit' ,  'source' ,  'export' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  project 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              repository  =  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              if  name  =~  %r{ ^(([a-z0-9 \ -]+) \ |)(.+)$ } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                repo_prefix ,  repo_identifier ,  name  =  $1 ,  $2 ,  $3 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                repository  =  project . repositories . detect  { | repo |  repo . identifier  ==  repo_identifier } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                repository  =  project . repository 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              if  prefix  ==  'commit' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                if  repository  &&  ( changeset  =  Changeset . visible . find ( :first ,  :conditions  = >  [ " repository_id = ? AND scmid LIKE ? " ,  repository . id ,  " #{ name } % " ] ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                  link  =  link_to  h ( " #{ project_prefix } #{ repo_prefix } #{ name } " ) ,  { :only_path  = >  only_path ,  :controller  = >  'repositories' ,  :action  = >  'revision' ,  :id  = >  project ,  :repository_id  = >  repository . identifier_param ,  :rev  = >  changeset . identifier } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               :class  = >  'changeset' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                               :title  = >  truncate_single_line ( h ( changeset . comments ) ,  :length  = >  100 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                if  repository  &&  User . current . allowed_to? ( :browse_repository ,  project ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                  name  =~  %r{ ^[/ \\ ]*(.*?)(@([0-9a-f]+))?( # (L \ d+))?$ } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                  path ,  rev ,  anchor  =  $1 ,  $3 ,  $5 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                  link  =  link_to  h ( " #{ project_prefix } #{ prefix } : #{ repo_prefix } #{ name } " ) ,  { :controller  = >  'repositories' ,  :action  = >  'entry' ,  :id  = >  project ,  :repository_id  = >  repository . identifier_param , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                          :path  = >  to_path_param ( path ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                          :rev  = >  rev , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                          :anchor  = >  anchor , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                          :format  = >  ( prefix  ==  'export'  ?  'raw'  :  nil ) } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                         :class  = >  ( prefix  ==  'export'  ?  'source download'  :  'source' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              repo_prefix  =  nil 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-12 20:28:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          when  'attachment' 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-14 08:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            attachments  =  options [ :attachments ]  ||  ( obj  &&  obj . respond_to? ( :attachments )  ?  obj . attachments  :  nil ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  attachments  &&  attachment  =  attachments . detect  { | a |  a . filename  ==  name  } 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-17 14:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              link  =  link_to  h ( attachment . filename ) ,  { :only_path  = >  only_path ,  :controller  = >  'attachments' ,  :action  = >  'download' ,  :id  = >  attachment } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                                                     :class  = >  'attachment' 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-13 10:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          when  'project' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if  p  =  Project . visible . find ( :first ,  :conditions  = >  [ " identifier = :s OR LOWER(name) = :s " ,  { :s  = >  name . downcase } ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-08 07:07:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              link  =  link_to_project ( p ,  { :only_path  = >  only_path } ,  :class  = >  'project' ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-13 10:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            end 
							 
						 
					
						
							
								
									
										
										
										
											2008-01-15 18:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
									
										
										
										
											2007-09-07 20:07:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
									
										
										
										
											2007-05-26 15:42:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      ( leading  +  ( link  ||  " #{ project_prefix } #{ prefix } #{ repo_prefix } #{ sep } #{ identifier } #{ comment_suffix } " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-05-26 15:42:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 16:25:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  HEADING_RE  =  / (<h(1|2|3|4)( [^>]+)?>(.+?)< \/ h(1|2|3|4)>) /i  unless  const_defined? ( :HEADING_RE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  parse_sections ( text ,  project ,  obj ,  attr ,  only_path ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  unless  options [ :edit_section_links ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    text . gsub! ( HEADING_RE )  do 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      heading  =  $1 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 18:22:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      @current_section  +=  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  @current_section  >  1 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 16:25:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        content_tag ( 'div' , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 18:22:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          link_to ( image_tag ( 'edit.png' ) ,  options [ :edit_section_links ] . merge ( :section  = >  @current_section ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 16:25:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          :class  = >  'contextual' , 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          :title  = >  l ( :button_edit_section ) )  +  heading . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 16:25:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      else 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-25 00:00:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        heading 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 16:25:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Headings and TOC 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Adds ids and links to headings unless options[:headings] is set to false 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  parse_headings ( text ,  project ,  obj ,  attr ,  only_path ,  options ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    return  if  options [ :headings ]  ==  false 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    text . gsub! ( HEADING_RE )  do 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 16:25:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      level ,  attrs ,  content  =  $2 . to_i ,  $3 ,  $4 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      item  =  strip_tags ( content ) . strip 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 17:25:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      anchor  =  sanitize_anchor_name ( item ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 15:57:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      # used for single-file wiki export 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      anchor  =  " #{ obj . page . title } _ #{ anchor } "  if  options [ :wiki_links ]  ==  :anchor  &&  ( obj . is_a? ( WikiContent )  ||  obj . is_a? ( WikiContent :: Version ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-14 08:09:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      @heading_anchors [ anchor ]  || =  0 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      idx  =  ( @heading_anchors [ anchor ]  +=  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  idx  >  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        anchor  =  " #{ anchor } - #{ idx } " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      @parsed_headings  <<  [ level ,  anchor ,  item ] 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-14 22:01:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      " <a name= \" #{ anchor } \" ></a> \n <h #{ level }   #{ attrs } > #{ content } <a href= \" # #{ anchor } \"  class= \" wiki-anchor \" >¶</a></h #{ level } > " 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-18 16:25:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  MACROS_RE  =  / 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ( ! ) ?                         # escaping 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                \ { \ {                         # opening tag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ( [ \ w ] + )                      # macro name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ( \ ( ( [ ^ \ } ] * ) \ ) ) ?              # optional arguments 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                \ } \ }                         # closing tag 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              / x unless const_defined?(:MACROS_RE)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Macros substitution 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  parse_macros ( text ,  project ,  obj ,  attr ,  only_path ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    text . gsub! ( MACROS_RE )  do 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      esc ,  all ,  macro  =  $1 ,  $2 ,  $3 . downcase 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      args  =  ( $5  ||  '' ) . split ( ',' ) . each ( & :strip ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  esc . nil? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        begin 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          exec_macro ( macro ,  obj ,  args ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        rescue  = >  e 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          " <div class= \" flash error \" >Error executing the <strong> #{ macro } </strong> macro ( #{ e } )</div> " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        end  ||  all 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        all 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  TOC_RE  =  / <p> \ { \ {([<>]?)toc \ } \ }< \/ p> /i  unless  const_defined? ( :TOC_RE ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-29 18:21:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Renders the TOC with given headings 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  replace_toc ( text ,  headings ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    text . gsub! ( TOC_RE )  do 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  headings . empty? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        '' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        div_class  =  'toc' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        div_class  <<  ' right'  if  $1  ==  '>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        div_class  <<  ' left'  if  $1  ==  '<' 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 18:52:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        out  =  " <ul class= \" #{ div_class } \" ><li> " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        root  =  headings . map ( & :first ) . min 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        current  =  root 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        started  =  false 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        headings . each  do  | level ,  anchor ,  item | 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 18:52:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          if  level  >  current 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            out  <<  '<ul><li>'  *  ( level  -  current ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          elsif  level  <  current 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            out  <<  " </li></ul> \n "  *  ( current  -  level )  +  " </li><li> " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          elsif  started 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            out  <<  '</li><li>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          out  <<  " <a href= \" # #{ anchor } \" > #{ item } </a> " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          current  =  level 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          started  =  true 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 18:52:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        out  <<  '</li></ul>'  *  ( current  -  root ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        out  <<  '</li></ul>' 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-06 17:47:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-07-14 11:25:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Same as Rails' simple_format helper without using paragraphs 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  simple_format_without_paragraph ( text ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    text . to_s . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      gsub ( / \ r \ n? / ,  " \n " ) .                     # \r\n and \r -> \n 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      gsub ( / \ n \ n+ / ,  " <br /><br /> " ) .           # 2+ newline  -> 2 br 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-06 11:03:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      gsub ( / ([^ \ n] \ n)(?=[^ \ n]) / ,  '\1<br />' ) .  # 1 newline   -> br 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2007-07-14 11:25:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  lang_options_for_select ( blank = true ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ( blank  ?  [ [ " (auto) " ,  " " ] ]  :  [ ] )  + 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-21 11:04:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      valid_languages . collect { | lang |  [  ll ( lang . to_s ,  :general_lang_name ) ,  lang . to_s ] } . sort { | x , y |  x . last  < = >  y . last  } 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  label_tag_for ( name ,  option_tags  =  nil ,  options  =  { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    label_text  =  l ( ( " field_ " + field . to_s . gsub ( / \ _id$ / ,  " " ) ) . to_sym )  +  ( options . delete ( :required )  ?  @template . content_tag ( " span " ,  "  * " ,  :class  = >  " required " ) :  " " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    content_tag ( " label " ,  label_text ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-23 19:44:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  labelled_tabular_form_for ( * args ,  & proc ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-09 18:15:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    ActiveSupport :: Deprecation . warn  " ApplicationHelper # labelled_tabular_form_for is deprecated and will be removed in Redmine 1.5. Use  # labelled_form_for instead. " 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-23 19:44:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    args  <<  { }  unless  args . last . is_a? ( Hash ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    options  =  args . last 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    options [ :html ]  || =  { } 
							 
						 
					
						
							
								
									
										
										
										
											2008-02-29 19:46:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    options [ :html ] [ :class ]  =  'tabular'  unless  options [ :html ] . has_key? ( :class ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-09 18:45:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    options . merge! ( { :builder  = >  Redmine :: Views :: LabelledFormBuilder } ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-23 19:44:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    form_for ( * args ,  & proc ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-26 17:56:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  labelled_form_for ( * args ,  & proc ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    args  <<  { }  unless  args . last . is_a? ( Hash ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    options  =  args . last 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-25 17:17:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  args . first . is_a? ( Symbol ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      options . merge! ( :as  = >  args . shift ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-09 18:45:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    options . merge! ( { :builder  = >  Redmine :: Views :: LabelledFormBuilder } ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-26 17:56:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    form_for ( * args ,  & proc ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-09 18:40:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  labelled_fields_for ( * args ,  & proc ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    args  <<  { }  unless  args . last . is_a? ( Hash ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    options  =  args . last 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-09 18:45:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    options . merge! ( { :builder  = >  Redmine :: Views :: LabelledFormBuilder } ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-09 18:40:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    fields_for ( * args ,  & proc ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  labelled_remote_form_for ( * args ,  & proc ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    args  <<  { }  unless  args . last . is_a? ( Hash ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    options  =  args . last 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 07:42:48 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    options . merge! ( { :builder  = >  Redmine :: Views :: LabelledFormBuilder ,  :remote  = >  true } ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 04:08:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    form_for ( * args ,  & proc ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-09 18:40:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-26 18:07:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  error_messages_for ( * objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    html  =  " " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    objects  =  objects . map  { | o |  o . is_a? ( String )  ?  instance_variable_get ( " @ #{ o } " )  :  o } . compact 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    errors  =  objects . map  { | o |  o . errors . full_messages } . flatten 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  errors . any? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      html  <<  " <div id='errorExplanation'><ul> \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      errors . each  do  | error | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        html  <<  " <li> #{ h  error } </li> \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      html  <<  " </ul></div> \n " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    html . html_safe 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-16 17:27:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  back_url_hidden_field_tag 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-26 08:46:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    back_url  =  params [ :back_url ]  ||  request . env [ 'HTTP_REFERER' ] 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-31 10:39:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    back_url  =  CGI . unescape ( back_url . to_s ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 00:02:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    hidden_field_tag ( 'back_url' ,  CGI . escape ( back_url ) ,  :id  = >  nil )  unless  back_url . blank? 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-16 17:27:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  check_all_links ( form_name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    link_to_function ( l ( :button_check_all ) ,  " checkAll(' #{ form_name } ', true) " )  + 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 11:51:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    "  |  " . html_safe  + 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to_function ( l ( :button_uncheck_all ) ,  " checkAll(' #{ form_name } ', false) " ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-12-05 19:21:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  progress_bar ( pcts ,  options = { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    pcts  =  [ pcts ,  pcts ]  unless  pcts . is_a? ( Array ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-21 10:50:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    pcts  =  pcts . collect ( & :round ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-12-05 19:21:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    pcts [ 1 ]  =  pcts [ 1 ]  -  pcts [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    pcts  <<  ( 100  -  pcts [ 1 ]  -  pcts [ 0 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-17 15:34:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    width  =  options [ :width ]  ||  '100px;' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    legend  =  options [ :legend ]  ||  '' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    content_tag ( 'table' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      content_tag ( 'tr' , 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 11:51:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        ( pcts [ 0 ]  >  0  ?  content_tag ( 'td' ,  '' ,  :style  = >  " width:  #{ pcts [ 0 ] } %; " ,  :class  = >  'closed' )  :  '' . html_safe )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ( pcts [ 1 ]  >  0  ?  content_tag ( 'td' ,  '' ,  :style  = >  " width:  #{ pcts [ 1 ] } %; " ,  :class  = >  'done' )  :  '' . html_safe )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ( pcts [ 2 ]  >  0  ?  content_tag ( 'td' ,  '' ,  :style  = >  " width:  #{ pcts [ 2 ] } %; " ,  :class  = >  'todo' )  :  '' . html_safe ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      ) ,  :class  = >  'progress' ,  :style  = >  " width:  #{ width } ; " ) . html_safe  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      content_tag ( 'p' ,  legend ,  :class  = >  'pourcent' ) . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2007-11-17 15:34:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-17 20:46:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  checked_image ( checked = true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  checked 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      image_tag  'toggle_check.png' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-04 19:02:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  context_menu ( url ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    unless  @context_menu_included 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      content_for  :header_tags  do 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        javascript_include_tag ( 'context_menu' )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          stylesheet_link_tag ( 'context_menu' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-22 19:12:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      if  l ( :direction )  ==  'rtl' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        content_for  :header_tags  do 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          stylesheet_link_tag ( 'context_menu_rtl' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-04 19:02:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      @context_menu_included  =  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    javascript_tag  " new ContextMenu(' #{  url_for ( url )  } ') " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  calendar_for ( field_id ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-31 21:48:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    include_calendar_headers_tags 
							 
						 
					
						
							
								
									
										
										
										
											2007-03-12 17:59:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    image_tag ( " calendar.png " ,  { :id  = >  " #{ field_id } _trigger " , :class  = >  " calendar-trigger " } )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    javascript_tag ( " Calendar.setup({inputField : ' #{ field_id } ', ifFormat : '%Y-%m-%d', button : ' #{ field_id } _trigger' }); " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-31 21:48:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  include_calendar_headers_tags 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    unless  @calendar_headers_tags_included 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      @calendar_headers_tags_included  =  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      content_for  :header_tags  do 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-13 04:06:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        start_of_week  =  case  Setting . start_of_week . to_i 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        when  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          'Calendar._FD = 1;'  # Monday 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        when  7 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          'Calendar._FD = 0;'  # Sunday 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 15:43:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        when  6 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          'Calendar._FD = 6;'  # Saturday 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-13 04:06:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          ''  # use language 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-03-31 21:48:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        javascript_include_tag ( 'calendar/calendar' )  + 
							 
						 
					
						
							
								
									
										
										
										
											2009-04-24 17:00:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        javascript_include_tag ( " calendar/lang/calendar- #{ current_language . to_s . downcase } .js " )  + 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        javascript_tag ( start_of_week )  + 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-31 21:48:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        javascript_include_tag ( 'calendar/calendar-setup' )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        stylesheet_link_tag ( 'calendar' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 09:10:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Overrides Rails' stylesheet_link_tag with themes and plugins support. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Examples: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   stylesheet_link_tag('styles') # => picks styles.css from the current theme or defaults 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   stylesheet_link_tag('styles', :plugin => 'foo) # => picks styles.css from plugin's assets 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  stylesheet_link_tag ( * sources ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    options  =  sources . last . is_a? ( Hash )  ?  sources . pop  :  { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    plugin  =  options . delete ( :plugin ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    sources  =  sources . map  do  | source | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  plugin 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        " /plugin_assets/ #{ plugin } /stylesheets/ #{ source } " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      elsif  current_theme  &&  current_theme . stylesheets . include? ( source ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        current_theme . stylesheet_path ( source ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        source 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    super  sources ,  options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 09:47:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Overrides Rails' image_tag with themes and plugins support. 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 09:18:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Examples: 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 09:47:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  #   image_tag('image.png') # => picks image.png from the current theme or defaults 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 09:18:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  #   image_tag('image.png', :plugin => 'foo) # => picks image.png from plugin's assets 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  image_tag ( source ,  options = { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  plugin  =  options . delete ( :plugin ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      source  =  " /plugin_assets/ #{ plugin } /images/ #{ source } " 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 09:47:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    elsif  current_theme  &&  current_theme . images . include? ( source ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      source  =  current_theme . image_path ( source ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 09:18:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    super  source ,  options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 09:10:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Overrides Rails' javascript_include_tag with plugins support 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # Examples: 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   javascript_include_tag('scripts') # => picks scripts.js from defaults 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  #   javascript_include_tag('scripts', :plugin => 'foo) # => picks scripts.js from plugin's assets 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  javascript_include_tag ( * sources ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    options  =  sources . last . is_a? ( Hash )  ?  sources . pop  :  { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  plugin  =  options . delete ( :plugin ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      sources  =  sources . map  do  | source | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        if  plugin 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          " /plugin_assets/ #{ plugin } /javascripts/ #{ source } " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          source 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    super  sources ,  options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-09-22 13:17:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  content_for ( name ,  content  =  nil ,  & block ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    @has_content  || =  { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    @has_content [ name ]  =  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    super ( name ,  content ,  & block ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2007-09-22 13:17:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  has_content? ( name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    ( @has_content  &&  @has_content [ name ] )  ||  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 05:57:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-01 10:19:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  sidebar_content? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    has_content? ( :sidebar )  ||  view_layouts_base_sidebar_hook_response . present? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  view_layouts_base_sidebar_hook_response 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    @view_layouts_base_sidebar_hook_response  || =  call_hook ( :view_layouts_base_sidebar ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-03 12:28:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  email_delivery_enabled? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    ! ! ActionMailer :: Base . perform_deliveries 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-27 11:08:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-11-09 14:52:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Returns the avatar image tag for the given +user+ if avatars are enabled 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>') 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  avatar ( user ,  options  =  {  } ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-31 00:41:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    if  Setting . gravatar_enabled? 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-25 17:17:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      options . merge! ( { :ssl  = >  ( request  &&  request . ssl? ) ,  :default  = >  Setting . gravatar_default } ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-09 14:52:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      email  =  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      if  user . respond_to? ( :mail ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        email  =  user . mail 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      elsif  user . to_s  =~  %r{ <(.+?)> } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        email  =  $1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      return  gravatar ( email . to_s . downcase ,  options )  unless  email . blank?  rescue  nil 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-10 03:09:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      '' 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-31 00:41:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-02 17:25:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  sanitize_anchor_name ( anchor ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    anchor . gsub ( %r{ [^ \ w \ s \ -] } ,  '' ) . gsub ( %r{ \ s+( \ -+ \ s*)? } ,  '-' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 09:53:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Returns the javascript tags that are included in the html layout head 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  javascript_heads 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-25 17:17:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    tags  =  javascript_include_tag ( 'prototype' ,  'effects' ,  'dragdrop' ,  'controls' ,  'rails' ,  'application' ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 09:53:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    unless  User . current . pref . warn_on_leaving_unsaved  ==  '0' 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 22:53:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      tags  <<  " \n " . html_safe  +  javascript_tag ( " Event.observe(window, 'load', function(){ new WarnLeavingUnsaved(' #{ escape_javascript (  l ( :text_warn_on_leaving_unsaved )  ) } '); }); " ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 09:53:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    tags 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-31 00:41:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-29 14:58:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  favicon 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-20 05:05:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    " <link rel='shortcut icon' href=' #{ image_path ( '/favicon.ico' ) } ' /> " . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-29 14:58:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-12 19:22:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  robot_exclusion_tag 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-28 12:20:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    '<meta name="robots" content="noindex,follow,noarchive" />' . html_safe 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-12 19:22:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-11 10:19:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Returns true if arg is expected in the API response 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  include_in_api_response? ( arg ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    unless  @included_in_api_response 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      param  =  params [ :include ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      @included_in_api_response  =  param . is_a? ( Array )  ?  param . collect ( & :to_s )  :  param . to_s . split ( ',' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      @included_in_api_response . collect! ( & :strip ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    @included_in_api_response . include? ( arg . to_s ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-29 14:58:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-11 13:13:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  # Returns options or nil if nometa param or X-Redmine-Nometa header 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  # was set in the request 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  def  api_meta ( options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    if  params [ :nometa ] . present?  ||  request . headers [ 'X-Redmine-Nometa' ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      # compatibility mode for activeresource clients that raise 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      # an error when unserializing an array with attributes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      options 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    end 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-10-27 11:08:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  private 
							 
						 
					
						
							
								
									
										
										
										
											2008-11-07 14:35:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-10-27 11:08:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  wiki_helper 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    helper  =  Redmine :: WikiFormatting . helper_for ( Setting . text_formatting ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    extend  helper 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    return  self 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-18 02:46:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-03 14:01:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  def  link_to_content_update ( text ,  url_params  =  { } ,  html_options  =  { } ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-03 14:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    link_to ( text ,  url_params ,  html_options ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-26 01:47:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  end 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-28 18:11:03 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								end