diff --git a/docs/upgrades/upgrade_5.4.3-5.5.0.sql b/docs/upgrades/upgrade_5.4.3-5.5.0.sql index 9937a3338..35846553d 100644 --- a/docs/upgrades/upgrade_5.4.3-5.5.0.sql +++ b/docs/upgrades/upgrade_5.4.3-5.5.0.sql @@ -137,3 +137,6 @@ insert into international (internationalId,languageId,namespace,message,lastUpda insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (14,1,'HttpProxy','Stop at', 1060433963,'A string used as ending point when proxying parts of remote content.'); INSERT INTO template VALUES (1,'Default HTTP Proxy','\r\n

\r\n
\r\n\r\n\r\n

\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n Error: Search string not found in content.\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n Warning: Ending search point not found in content.\r\n \r\n','HttpProxy'); UPDATE international set message = 'The HTTP Proxy wobject is a very powerful tool. It enables you to embed external sites and applications into your site. For example, if you have a web mail system that you wish your staff could access through the intranet, then you could use the HTTP Proxy to accomplish that.\r\n\r\n

\r\n\r\nURL
\r\nThe starting URL for the proxy.\r\n

\r\n\r\nFollow redirects?
\r\nSometimes the URL to a page, is actually a redirection to another page. Do you wish to follow those redirections when they occur?\r\n

\r\n\r\nRewrite urls?
\r\nSwitch this to No if you want to deeplink an external page.\r\n

\r\n\r\nTimeout
\r\nThe amount of time (in seconds) that WebGUI should wait for a connection before giving up on an external page.\r\n

\r\n\r\nRemove style?
\r\nDo you wish to remove the stylesheet from the proxied content in favor of the stylesheet from your site?\r\n

\r\n\r\nFilter Content
\r\nChoose the level of HTML filtering you wish to apply to the proxied content.\r\n

\r\n\r\nSearch for
\r\nA search string used as starting point. Use this when you want to display only a part of the proxied content. Content before this point is not displayed\r\n

\r\n\r\nStop at
\r\nA search string used as ending point. Content after this point is not displayed.\r\n

\r\nNote: The Search for and Stop at strings are included in the content. You can change this by editing the template for HttpProxy.\r\n

\r\n\r\nAllow proxying of other domains?
\r\nIf you proxy a site like Yahoo! that links to other domains, do you wish to allow the user to follow the links to those other domains, or should the proxy stop them as they try to leave the original site you specified?\r\n

\r\n' where internationalId = 11 and namespace = 'HttpProxy' and languageId = 1; +update international set internationalId=1014, namespace='WebGUI' where internationalId='17' and namespace='MessageBoard'; +update international set internationalId=1015, namespace='WebGUI' where internationalId='11' and namespace='MessageBoard'; + diff --git a/lib/WebGUI/Forum/Post.pm b/lib/WebGUI/Forum/Post.pm index cc6c4fc7c..fd07c2f5a 100644 --- a/lib/WebGUI/Forum/Post.pm +++ b/lib/WebGUI/Forum/Post.pm @@ -51,6 +51,11 @@ sub getThread { return $self->{_thread}; } +sub incrementViews { + my ($self) = @_; + WebGUI::SQL->write("update forumPost set views=views+1 where forumPostId=".$self->get("forumPostId")); +} + sub isMarkedRead { my ($self, $userId) = @_; $userId = $session{user}{userId} unless ($userId); @@ -61,10 +66,11 @@ sub isMarkedRead { sub markRead { my ($self, $userId) = @_; $userId = $session{user}{userId} unless ($userId); - unless (isMarkedRead($userId)) { + unless ($self->isMarkedRead($userId)) { WebGUI::SQL->write("insert into forumRead (userId, forumPostId, forumThreadId, lastRead) values ($userId, ".$self->get("forumPostId").", ".$self->get("forumThreadId").", ".WebGUI::DateTime::time().")"); } + $self->incrementViews; } sub new { diff --git a/lib/WebGUI/Forum/Web.pm b/lib/WebGUI/Forum/Web.pm index 1404305c2..ec48cf47f 100644 --- a/lib/WebGUI/Forum/Web.pm +++ b/lib/WebGUI/Forum/Web.pm @@ -93,21 +93,21 @@ sub _getPostTemplateVars { } $sth->finish; } - $var->{'post.date'} = _formatPostDate($post->get("dateOfPost")); + $var->{'post.date.value'} = _formatPostDate($post->get("dateOfPost")); $var->{'post.date.label'} = WebGUI::International::get(239); - $var->{'post.time'} = _formatPostTime($post->get("dateOfPost")); - $var->{'post.views'} = $post->get("views"); + $var->{'post.date.epoch'} = $post->get("dateOfPost"); + $var->{'post.time.value'} = _formatPostTime($post->get("dateOfPost")); + $var->{'post.views.value'} = $post->get("views"); $var->{'post.views.label'} = WebGUI::International::get(514); - $var->{'post.status'} = _formatStatus($post->get("status")); + $var->{'post.status.value'} = _formatStatus($post->get("status")); $var->{'post.status.label'} = WebGUI::International::get(553); $var->{'post.isLocked'} = $thread->isLocked; $var->{'post.isModerator'} = $forum->isModerator; $var->{'post.user.label'} = WebGUI::International::get(238); - $var->{'post.username'} = $post->get("username"); - $var->{'post.userId'} = $post->get("userId"); - $var->{'post.userProfile'} = _formatUserProfileURL($post->get("userId")); + $var->{'post.user.name'} = $post->get("username"); + $var->{'post.user.Id'} = $post->get("userId"); + $var->{'post.user.Profile'} = _formatUserProfileURL($post->get("userId")); $var->{'post.id'} = $post->get("forumPostId"); - $var->{'post.full'} = WebGUI::Template::process(WebGUI::Template::get(1,"Forum/Post"), $var); $var->{'post.reply.label'} = WebGUI::International::get(577); $var->{'post.reply.url'} = _formatReplyPostURL($callback,$post->get("forumPostId")); $var->{'post.edit.label'} = WebGUI::International::get(575); @@ -120,7 +120,8 @@ sub _getPostTemplateVars { $var->{'post.deny.url'} = _formatDenyPostURL($callback,$post->get("forumPostId")); $var->{'post.pending.label'} = WebGUI::International::get(573); $var->{'post.pending.url'} = _formatLeavePostPendingURL(); - $var->{'post.tools.label'} = WebGUI::International::get(238); + $var->{'post.tools.label'} = WebGUI::International::get(0); + $var->{'post.full'} = WebGUI::Template::process(WebGUI::Template::get(1,"Forum/Post"), $var); return $var; } @@ -336,22 +337,23 @@ sub www_viewThread { my ($callback, $postId) = @_; $postId = $session{form}{forumPostId} unless ($postId); my $post = WebGUI::Forum::Post->new($postId); + $post->markRead($session{user}{userId}); my $thread = $post->getThread; my $forum = $thread->getForum; my $var = _getPostTemplateVars($post, $thread, $forum, $callback); my $root = WebGUI::Forum::Post->new($thread->get("rootPostId")); $var->{post_loop} = _recurseThread($root, $thread, $forum, 0, $callback); $var->{'thread.layout.isFlat'} = ($session{user}{discussionLayout} eq "flat"); - $var->{'thread.layout.isThreaded'} = ($session{user}{discussionLayout} eq "threaded"); $var->{'thread.layout.isNested'} = ($session{user}{discussionLayout} eq "nested"); + $var->{'thread.layout.isThreaded'} = ($session{user}{discussionLayout} eq "threaded" || !($var->{'thread.layout.isNested'} || $var->{'thread.layout.isFlat'})); $var->{'thread.new.url'} = ''; - $var->{'thread.new.label'} = WebGUI::International::get(0); + $var->{'thread.new.label'} = WebGUI::International::get(1014); $var->{'thread.previous.url'} = _formatPreviousThreadURL($callback,$thread->get("forumThreadId")); $var->{'thread.previous.label'} = WebGUI::International::get(513); $var->{'thread.next.url'} = _formatNextThreadURL($callback,$thread->get("forumThreadId")); $var->{'thread.next.label'} = WebGUI::International::get(512); - $var->{'thread.list.url'} = ''; - $var->{'thread.list.label'} = WebGUI::International::get(0); + $var->{'thread.list.url'} = $callback; + $var->{'thread.list.label'} = WebGUI::International::get(1015); return WebGUI::Template::process(WebGUI::Template::get(1,"Forum/Thread"), $var); }