start fixing test for multi cat phenotype upload.
[sgn.git] / lib / CXGN / People / Forum.pm
blobc8b45a98e802a8f9e010a23b9735803f9af867d5
1 =head1 NAME
3 CXGN::People::Forum - classes to handle the SOL forum on the SGN website.
5 =head1 DESCRIPTION
7 The Forum comprises three main classes:
9 =over 5
11 =item o
13 CXGN::People::Forum
15 =item o
17 CXGN::People::Forum::Topic
19 =item o
21 CXGN::People::Forum::Post
23 =back
25 These are described in more detail below.
27 =head1 AUTHOR
29 Lukas Mueller (lam87@cornell.edu)
31 =cut
33 use strict;
34 require CXGN::Contact;
35 use CXGN::People::Forum::Topic;
36 use CXGN::People::Forum::Post;
38 =head1 PACKAGE CXGN::People::Forum
40 Parent class of CXGN::People::* classes that essentially handles database access and provides utility functions used by all subclasses.
42 =cut
44 package CXGN::People::Forum;
46 #use base qw( CXGN::Class::DBI );
47 use base qw | CXGN::DB::Object |;
50 =head2 function new()
52 Synopsis: constructor
53 Arguments: none
54 Returns: a CXGN::People::Forum object
55 Side effects: establishes a connection to the database
56 Description: should not be called explicitly, but rather
57 by subclasses of this class.
59 =cut
61 sub new {
62 my $class = shift;
63 my $dbh = shift;
65 my $self = $class->SUPER::new($dbh);
67 return $self;
70 =head2 function format_post_text()
72 Synopsis:
73 Arguments:
74 Returns:
75 Side effects:
76 Description: formats a post or topic text for display.
77 Note that it converts certain embedded tags to
78 html links. This function does not assure security
79 - use the get_encoded_arguments in the CXGN::Page
80 object for that purpose.
82 =cut
84 sub format_post_text {
85 my $self = shift;
86 my $post_text = shift;
88 # support vB script url tag
89 while ($post_text =~ /\[url\](.*?)\[\/url\]/g ) {
90 my $link = $1;
91 my $replace_link = $link;
92 if ($link !~ /^http/i) {
93 $replace_link = "http:\/\/$link";
95 $post_text =~ s/\[url\]$link\[\/url\]/\<a href=\"$replace_link\"\>$replace_link\<\/a\>/g;
97 # convert newlines to <br /> tags
99 $post_text =~ s/\n/\<br \/\>/g;
100 return $post_text;