3 use CXGN
::DB
::Connection
;
6 use CXGN
::People
::Person
;
8 use CXGN
::People
::Forum
;
10 use CXGN
::Page
::FormattingHelpers qw
/page_title_html blue_section_html/;
12 my $page = CXGN
::Page
->new("Forum Main", "Lukas");
14 my $dbh = CXGN
::DB
::Connection
->new();
15 my $sp_person_id = CXGN
::Login
->new($dbh)->has_session();
17 my ($topic_name, $topic_description) = $page -> get_encoded_arguments
("topic_name", "topic_description", "topic_id", "post_text", "post_parent_id");
19 # create a user object, representing the user who is logged in,
20 # or a dummy user object if not logged in.
26 $user = CXGN
::People
::Person
->new($dbh, $sp_person_id);
27 $sp_person_id = $user -> get_sp_person_id
();
28 $name = $user->get_first_name()." ".$user->get_last_name();
30 else { $user = CXGN
::People
::Person
->new($dbh); }
33 my $sp_person_id = CXGN
::Login
->new($dbh)->verify_session();
35 my $topic = CXGN
::People
::Forum
::Topic
-> new
($dbh);
36 $topic->set_topic_name($topic_name);
37 $topic->set_topic_description($topic_description);
38 $topic->set_person_id($sp_person_id);
41 CXGN
::Contact
::email_us
("New topic submitted: $topic_name","Description: $topic_description",'email');
49 print page_title_html
("Forum Topics");
54 $s = topics_list
($dbh, $name, $user);
57 if ($name) { $login_string = qq { You are logged
in as
<b
>$name</b>. <a href="add_topic.pl?action=new"><b>Add topic</b
></a>.<br /><br
/> }; }
58 else { $login_string="<b>Note:</b> <ul><li>You are not logged in.</li><li>You have to be logged in to add new topics and posts. </li><li>You don't need to be logged in for browsing.</li></ul><br /> [<a href=\"/solpeople/login.pl?goto_url=/forum/topics.pl\">Login</a>] <br /><br />\n"; }
72 my @topics = CXGN
::People
::Forum
::Topic
::all_topics
($dbh);
76 foreach my $t (@topics) {
77 my $topic_name = $t->get_topic_name();
78 my $topic_description = $t->get_topic_description();
80 my $topic_id = $t -> get_forum_topic_id
();
81 my $submitter = CXGN
::People
::Person
->new($dbh, $t->get_person_id());
82 my $submitter_name = $submitter->get_first_name()." ".$submitter->get_last_name();
83 my $submitter_id = $submitter->get_sp_person_id();
84 my $post_count = $t -> get_post_count
();
85 my $most_recent_post_date = $t -> get_most_recent_post_date
();
86 my $topic_person_id = $t->get_person_id();
87 my $user_id = $user->get_sp_person_id();
90 my $display_topic_desc = $t->format_post_text($topic_description);
92 ($user_id && $topic_person_id == $user_id)
93 || $user->get_user_type() eq "curator"
96 <a href
="add_topic.pl?action=edit&topic_id=$topic_id">edit
</a
> |
97 <a href
="add_topic.pl?action=delete&topic_id=$topic_id">delete</a
>
105 <table summary
="" border
="0" class="topicbox">
107 <td width
="250"><a href
="posts.pl?topic_id=$topic_id"><b
>$topic_name</b></a></td
>
108 <td width
="250">started by
<b
><a href
="/solpeople/personal-info.pl?sp_person_id=$submitter_id">$submitter_name</a></b
></td
>
109 <td width
="80" align
="center"><a href
="posts.pl?topic_id=$topic_id"><b
>$post_count</b> posts</a></td
>
110 <td align
="right" width
="140">$most_recent_post_date</td
>
113 <table summary
="" border
="0" class="topicdescbox">
115 <td width
="640">$display_topic_desc</td><td width="88" align="right">$append</td
>
119 <table summary
=""><tr
><td
></td></tr
></table
>