563 |
563 |
filename, ext, alt, alttext = $1.downcase, $2, $3, $4
|
564 |
564 |
# search for the picture in attachments
|
565 |
565 |
if found = Attachment.latest_attach(attachments, filename)
|
566 |
|
image_url = download_named_attachment_path(found, found.filename, :only_path => only_path)
|
|
566 |
image_url = download_named_attachment_path(found, found.filename, :only_path => only_path, :host=>Setting.host_name)
|
567 |
567 |
desc = found.description.to_s.gsub('"', '')
|
568 |
568 |
if !desc.blank? && alttext.blank?
|
569 |
569 |
alt = " title=\"#{desc}\" alt=\"#{desc}\""
|
... | ... | |
615 |
615 |
else
|
616 |
616 |
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
|
617 |
617 |
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
|
618 |
|
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
|
|
618 |
url_for(:only_path => only_path, :host=>Setting.host_name, :controller => 'wiki', :action => 'show', :project_id => link_project,
|
619 |
619 |
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
|
620 |
620 |
end
|
621 |
621 |
end
|
... | ... | |
681 |
681 |
end
|
682 |
682 |
# project.changesets.visible raises an SQL error because of a double join on repositories
|
683 |
683 |
if repository && (changeset = Changeset.visible.find_by_repository_id_and_revision(repository.id, identifier))
|
684 |
|
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},
|
|
684 |
link = link_to(h("#{project_prefix}#{repo_prefix}r#{identifier}"), {:only_path => only_path, :host=>Setting.host_name, :controller => 'repositories', :action => 'revision', :id => project, :repository_id => repository.identifier_param, :rev => changeset.revision},
|
685 |
685 |
:class => 'changeset',
|
686 |
686 |
:title => truncate_single_line(changeset.comments, :length => 100))
|
687 |
687 |
end
|
... | ... | |
692 |
692 |
when nil
|
693 |
693 |
if oid.to_s == identifier && issue = Issue.visible.find_by_id(oid, :include => :status)
|
694 |
694 |
anchor = comment_id ? "note-#{comment_id}" : nil
|
695 |
|
link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid, :anchor => anchor},
|
|
695 |
link = link_to("##{oid}", {:only_path => only_path, :host=>Setting.host_name, :controller => 'issues', :action => 'show', :id => oid, :anchor => anchor},
|
696 |
696 |
:class => issue.css_classes,
|
697 |
697 |
:title => "#{truncate(issue.subject, :length => 100)} (#{issue.status.name})")
|
698 |
698 |
end
|
699 |
699 |
when 'document'
|
700 |
700 |
if document = Document.visible.find_by_id(oid)
|
701 |
|
link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document},
|
|
701 |
link = link_to h(document.title), {:only_path => only_path, :host=>Setting.host_name, :controller => 'documents', :action => 'show', :id => document},
|
702 |
702 |
:class => 'document'
|
703 |
703 |
end
|
704 |
704 |
when 'version'
|
705 |
705 |
if version = Version.visible.find_by_id(oid)
|
706 |
|
link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},
|
|
706 |
link = link_to h(version.name), {:only_path => only_path, :host=>Setting.host_name, :controller => 'versions', :action => 'show', :id => version},
|
707 |
707 |
:class => 'version'
|
708 |
708 |
end
|
709 |
709 |
when 'message'
|
710 |
710 |
if message = Message.visible.find_by_id(oid, :include => :parent)
|
711 |
|
link = link_to_message(message, {:only_path => only_path}, :class => 'message')
|
|
711 |
link = link_to_message(message, {:only_path => only_path, :host=>Setting.host_name}, :class => 'message')
|
712 |
712 |
end
|
713 |
713 |
when 'forum'
|
714 |
714 |
if board = Board.visible.find_by_id(oid)
|
715 |
|
link = link_to h(board.name), {:only_path => only_path, :controller => 'boards', :action => 'show', :id => board, :project_id => board.project},
|
|
715 |
link = link_to h(board.name), {:only_path => only_path, :host=>Setting.host_name, :controller => 'boards', :action => 'show', :id => board, :project_id => board.project},
|
716 |
716 |
:class => 'board'
|
717 |
717 |
end
|
718 |
718 |
when 'news'
|
719 |
719 |
if news = News.visible.find_by_id(oid)
|
720 |
|
link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news},
|
|
720 |
link = link_to h(news.title), {:only_path => only_path, :host=>Setting.host_name, :controller => 'news', :action => 'show', :id => news},
|
721 |
721 |
:class => 'news'
|
722 |
722 |
end
|
723 |
723 |
when 'project'
|
724 |
724 |
if p = Project.visible.find_by_id(oid)
|
725 |
|
link = link_to_project(p, {:only_path => only_path}, :class => 'project')
|
|
725 |
link = link_to_project(p, {:only_path => only_path, :host=>Setting.host_name}, :class => 'project')
|
726 |
726 |
end
|
727 |
727 |
end
|
728 |
728 |
elsif sep == ':'
|
... | ... | |
731 |
731 |
case prefix
|
732 |
732 |
when 'document'
|
733 |
733 |
if project && document = project.documents.visible.find_by_title(name)
|
734 |
|
link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document},
|
|
734 |
link = link_to h(document.title), {:only_path => only_path, :host=>Setting.host_name, :controller => 'documents', :action => 'show', :id => document},
|
735 |
735 |
:class => 'document'
|
736 |
736 |
end
|
737 |
737 |
when 'version'
|
738 |
738 |
if project && version = project.versions.visible.find_by_name(name)
|
739 |
|
link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},
|
|
739 |
link = link_to h(version.name), {:only_path => only_path, :host=>Setting.host_name, :controller => 'versions', :action => 'show', :id => version},
|
740 |
740 |
:class => 'version'
|
741 |
741 |
end
|
742 |
742 |
when 'forum'
|
743 |
743 |
if project && board = project.boards.visible.find_by_name(name)
|
744 |
|
link = link_to h(board.name), {:only_path => only_path, :controller => 'boards', :action => 'show', :id => board, :project_id => board.project},
|
|
744 |
link = link_to h(board.name), {:only_path => only_path, :host=>Setting.host_name, :controller => 'boards', :action => 'show', :id => board, :project_id => board.project},
|
745 |
745 |
:class => 'board'
|
746 |
746 |
end
|
747 |
747 |
when 'news'
|
748 |
748 |
if project && news = project.news.visible.find_by_title(name)
|
749 |
|
link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news},
|
|
749 |
link = link_to h(news.title), {:only_path => only_path, :host=>Setting.host_name, :controller => 'news', :action => 'show', :id => news},
|
750 |
750 |
:class => 'news'
|
751 |
751 |
end
|
752 |
752 |
when 'commit', 'source', 'export'
|
... | ... | |
760 |
760 |
end
|
761 |
761 |
if prefix == 'commit'
|
762 |
762 |
if repository && (changeset = Changeset.visible.where("repository_id = ? AND scmid LIKE ?", repository.id, "#{name}%").first)
|
763 |
|
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},
|
|
763 |
link = link_to h("#{project_prefix}#{repo_prefix}#{name}"), {:only_path => only_path, :host=>Setting.host_name, :controller => 'repositories', :action => 'revision', :id => project, :repository_id => repository.identifier_param, :rev => changeset.identifier},
|
764 |
764 |
:class => 'changeset',
|
765 |
765 |
:title => truncate_single_line(changeset.comments, :length => 100)
|
766 |
766 |
end
|
... | ... | |
780 |
780 |
when 'attachment'
|
781 |
781 |
attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil)
|
782 |
782 |
if attachments && attachment = Attachment.latest_attach(attachments, name)
|
783 |
|
link = link_to_attachment(attachment, :only_path => only_path, :download => true, :class => 'attachment')
|
|
783 |
link = link_to_attachment(attachment, :only_path => only_path, :host=>Setting.host_name, :download => true, :class => 'attachment')
|
784 |
784 |
end
|
785 |
785 |
when 'project'
|
786 |
786 |
if p = Project.visible.where("identifier = :s OR LOWER(name) = :s", :s => name.downcase).first
|
787 |
|
link = link_to_project(p, {:only_path => only_path}, :class => 'project')
|
|
787 |
link = link_to_project(p, {:only_path => only_path, :host=>Setting.host_name}, :class => 'project')
|
788 |
788 |
end
|
789 |
789 |
end
|
790 |
790 |
end
|