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");
53 if ($name) { $login_string = qq { <div
class="row"><div
class="panel panel-primary"><div
class="panel-body"><div
class="row"><div
class="col-sm-10">You are logged
in as
<b
>$name</b>.</div
><div
class="col-sm-2"><button
class="btn btn-primary" onclick
='location.href="add_topic.pl?action=new";'>Add topic
</button>.</div
></div></div
></div></div
> }; }
54 else { $login_string="<div class=\"row\"><div class=\"panel panel-primary\"><div class=\"panel-body\"><div class=\"row\"><div class=\"col-sm-10\"><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></div><div class=\"col-sm-2\"><button class=\"btn btn-primary\" onclick='location.href=\"/user/login?goto_url=/forum/topics.pl\";'>Login</button></div></div></div></div></div>"; }
59 $s = topics_list
($dbh, $name, $user);
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
>
106 <div
class="panel panel-default">
107 <div
class="panel-heading">
109 <div
class="col-sm-6">
110 <a href
="posts.pl?topic_id=$topic_id"><b
>$topic_name</b></a>
112 <div
class="col-sm-2">
113 Started by
:<br
/><b><a href="/solpeople
/personal-info.pl?sp_person_id=$submitter_id">$submitter_name</a></b
>
115 <div
class="col-sm-2">
116 <a href
="posts.pl?topic_id=$topic_id"><b
>$post_count</b> Posts</a>
118 <div
class="col-sm-2">
119 $most_recent_post_date
125 <div
class="panel-body">