continuing to work on forum

This commit is contained in:
JT Smith 2003-08-24 01:18:59 +00:00
parent 6d117f9ac6
commit 74c733c2d4
3 changed files with 25 additions and 14 deletions

View file

@ -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','<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <tmpl_var description><p />\r\n</tmpl_if>\r\n\r\n<tmpl_if search.for>\r\n <tmpl_if content>\r\n <!-- Display search string. Remove if unwanted -->\r\n <tmpl_var search.for>\r\n <tmpl_else>\r\n <!-- Error: Starting point not found -->\r\n <b>Error: Search string <i><tmpl_var search.for></i> not found in content.</b>\r\n </tmpl_if>\r\n</tmpl_if>\r\n\r\n<tmpl_var content>\r\n\r\n<tmpl_if stop.at>\r\n <tmpl_if content.trailing>\r\n <!-- Display stop search string. Remove if unwanted -->\r\n <tmpl_var stop.at>\r\n <tmpl_else>\r\n <!-- Warning: End point not found -->\r\n <b>Warning: Ending search point <i><tmpl_var stop.at></i> not found in content.</b>\r\n </tmpl_if>\r\n</tmpl_if>','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<p>\r\n\r\n<b>URL</b><br>\r\nThe starting URL for the proxy.\r\n<p>\r\n\r\n<b>Follow redirects?</b><br>\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<p>\r\n\r\n<b>Rewrite urls?</b><br>\r\nSwitch this to No if you want to deeplink an external page.\r\n<p>\r\n\r\n<b>Timeout</b><br>\r\nThe amount of time (in seconds) that WebGUI should wait for a connection before giving up on an external page.\r\n<p>\r\n\r\n<b>Remove style?</b><br>\r\nDo you wish to remove the stylesheet from the proxied content in favor of the stylesheet from your site?\r\n<p>\r\n\r\n<b>Filter Content</b><br>\r\nChoose the level of HTML filtering you wish to apply to the proxied content.\r\n<p>\r\n\r\n<b>Search for</b><br>\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<p>\r\n\r\n<b>Stop at</b><br>\r\nA search string used as ending point. Content after this point is not displayed.\r\n<p>\r\n<i>Note: The <b>Search for</b> and <b>Stop at</b> strings are included in the content. You can change this by editing the template for HttpProxy.</i>\r\n<p>\r\n\r\n<b>Allow proxying of other domains?</b><br>\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<p>\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';

View file

@ -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 {

View file

@ -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);
}