working out some kinks

This commit is contained in:
JT Smith 2003-10-18 04:38:47 +00:00
parent b9de5b1a3c
commit 65a9ecbd34
5 changed files with 36 additions and 39 deletions

View file

@ -18,12 +18,6 @@ create table forum (
allowReplacements int not null default 1 allowReplacements int not null default 1
); );
create table forumReplacement (
forumReplacementId int not null primary key,
pattern varchar(255),
replaceWith varchar(255)
);
create table forumPost ( create table forumPost (
forumPostId int not null primary key, forumPostId int not null primary key,
parentId int not null default 0, parentId int not null default 0,
@ -149,6 +143,7 @@ delete from international where namespace='WebGUI' and internationalId=238;
delete from international where namespace='WebGUI' and internationalId=239; delete from international where namespace='WebGUI' and internationalId=239;
delete from international where namespace='WebGUI' and internationalId=1014; delete from international where namespace='WebGUI' and internationalId=1014;
delete from international where namespace='WebGUI' and internationalId=1015; delete from international where namespace='WebGUI' and internationalId=1015;
delete from international where namespace='MessageBoard' and internationalId=4;
delete from international where languageId=1 and namespace='WebGUI' and internationalId=512; delete from international where languageId=1 and namespace='WebGUI' and internationalId=512;
insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (512,1,'WebGUI','Go to next thread', 1065280309,NULL); insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (512,1,'WebGUI','Go to next thread', 1065280309,NULL);
delete from international where languageId=1 and namespace='WebGUI' and internationalId=513; delete from international where languageId=1 and namespace='WebGUI' and internationalId=513;
@ -245,4 +240,8 @@ INSERT INTO replacements VALUES (10,'[/b]','</b>');
INSERT INTO replacements VALUES (11,'[i]','<i>'); INSERT INTO replacements VALUES (11,'[i]','<i>');
INSERT INTO replacements VALUES (12,'[/i]','</i>'); INSERT INTO replacements VALUES (12,'[/i]','</i>');
INSERT INTO replacements VALUES (0,NULL,NULL); INSERT INTO replacements VALUES (0,NULL,NULL);
alter table forum add column masterForumId int;
alter table USS_submission add column forumId int;

View file

@ -68,6 +68,26 @@ sub isSubscribed {
sub new { sub new {
my ($class, $forumId) = @_; my ($class, $forumId) = @_;
my $properties = WebGUI::SQL->getRow("forum","forumId",$forumId); my $properties = WebGUI::SQL->getRow("forum","forumId",$forumId);
if ($properties->{masterForumId}) {
my $master = WebGUI::SQL->getRow("forum","forumId",$properties->{masterForumId});
$properties->{forumTemplateId} = $master->{forumTemplateId};
$properties->{threadTemplateId} = $master->{threadTemplateId};
$properties->{postTemplateId} = $master->{postTemplateId};
$properties->{searchTemplateId} = $master->{searchTemplateId};
$properties->{notificationTemplateId} = $master->{notificationTemplateId};
$properties->{postFormTemplateId} = $master->{postFormTemplateId};
$properties->{archiveAfter} = $master->{archiveAfter};
$properties->{allowRichEdit} = $master->{allowRichEdit};
$properties->{allowReplacements} = $master->{allowReplacements};
$properties->{filterPosts} = $master->{filterPosts};
$properties->{karmaPerPost} = $master->{karmaPerPost};
$properties->{groupToPost} = $master->{groupToPost};
$properties->{groupToModerate} = $master->{groupToModerate};
$properties->{moderatePosts} = $master->{moderatePosts};
$properties->{attachmentsPerPost} = $master->{attachmentsPerPost};
$properties->{addEditStampToPosts} = $master->{addEditStampsToPost};
$properties->{postsPerPage} = $master->{postsPerPage};
}
bless {_properties=>$properties}, $class; bless {_properties=>$properties}, $class;
} }

View file

@ -193,7 +193,7 @@ sub www_view {
$templateId = $_[0]->get("templateId"); $templateId = $_[0]->get("templateId");
} }
if ($session{form}{forumOp}) { if ($session{form}{forumOp}) {
return WebGUI::Forum::UI::forumOp($callback,$_[0]->get("forumId")); return WebGUI::Forum::UI::forumOp($callback);
} else { } else {
return $_[0]->processTemplate($templateId,\%var); return $_[0]->processTemplate($templateId,\%var);
} }

View file

@ -50,27 +50,11 @@ sub new {
my $property = shift; my $property = shift;
my $self = WebGUI::Wobject->new( my $self = WebGUI::Wobject->new(
-properties=>$property, -properties=>$property,
-extendedProperties=>{
messagesPerPage=>{
defaultValue=>50
}
},
-useTemplate=>1 -useTemplate=>1
); );
bless $self, $class; bless $self, $class;
} }
#-------------------------------------------------------------------
sub status {
if ($_[0] eq "Approved") {
return WebGUI::International::get(560);
} elsif ($_[0] eq "Denied") {
return WebGUI::International::get(561);
} elsif ($_[0] eq "Pending") {
return WebGUI::International::get(562);
}
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_deleteForum { sub www_deleteForum {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId"))); return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
@ -89,14 +73,7 @@ sub www_deleteForumConfirm {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_edit { sub www_edit {
my $properties = WebGUI::HTMLForm->new; my $properties = WebGUI::HTMLForm->new;
my $layout = WebGUI::HTMLForm->new;
$layout->integer(
-name=>"messagesPerPage",
-label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>$_[0]->getValue("messagesPerPage")
);
return $_[0]->SUPER::www_edit( return $_[0]->SUPER::www_edit(
-layout=>$layout->printRowsOnly,
-properties=>$properties->printRowsOnly, -properties=>$properties->printRowsOnly,
-headingId=>6, -headingId=>6,
-helpId=>1 -helpId=>1
@ -166,11 +143,6 @@ sub www_moveForumUp {
return ""; return "";
} }
#-------------------------------------------------------------------
sub www_showMessage {
return $_[0]->SUPER::www_showMessage('<a href="'.WebGUI::URL::page().'">'.WebGUI::International::get(11,$_[0]->get("namespace")).'</a><br>');
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_view { sub www_view {
my $callback = WebGUI::URL::page("func=view&amp;wid=".$_[0]->get("wobjectId")); my $callback = WebGUI::URL::page("func=view&amp;wid=".$_[0]->get("wobjectId"));
@ -210,7 +182,7 @@ sub www_view {
'forum.url' => WebGUI::Forum::UI::formatForumURL($callback,$forum->get("forumId")), 'forum.url' => WebGUI::Forum::UI::formatForumURL($callback,$forum->get("forumId")),
'forum.lastPost.url' => WebGUI::Forum::UI::formatThreadURL($callback,$lastPost->get("forumPostId")), 'forum.lastPost.url' => WebGUI::Forum::UI::formatThreadURL($callback,$lastPost->get("forumPostId")),
'forum.lastPost.date' => WebGUI::Forum::UI::formatPostDate($lastPost->get("dateOfPost")), 'forum.lastPost.date' => WebGUI::Forum::UI::formatPostDate($lastPost->get("dateOfPost")),
'forum.lastPost.time' => WebGUI::Forum::UI::formatPostDate($lastPost->get("dateOfPost")), 'forum.lastPost.time' => WebGUI::Forum::UI::formatPostTime($lastPost->get("dateOfPost")),
'forum.lastPost.epoch' => $lastPost->get("dateOfPost"), 'forum.lastPost.epoch' => $lastPost->get("dateOfPost"),
'forum.lastPost.subject' => WebGUI::Forum::UI::formatSubject($lastPost->get("subject")), 'forum.lastPost.subject' => WebGUI::Forum::UI::formatSubject($lastPost->get("subject")),
'forum.lastPost.user.id' => $lastPost->get("userId"), 'forum.lastPost.user.id' => $lastPost->get("userId"),

View file

@ -14,6 +14,7 @@ use strict;
use Tie::CPHash; use Tie::CPHash;
use WebGUI::Attachment; use WebGUI::Attachment;
use WebGUI::DateTime; use WebGUI::DateTime;
use WebGUI::Forum;
use WebGUI::Forum::UI; use WebGUI::Forum::UI;
use WebGUI::HTML; use WebGUI::HTML;
use WebGUI::HTMLForm; use WebGUI::HTMLForm;
@ -314,6 +315,11 @@ sub www_editSubmissionSave {
&& WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute"))) && WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")))
|| WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) { || WebGUI::Privilege::isInGroup($_[0]->get("groupToApprove"))) {
if ($session{form}{sid} eq "new") { if ($session{form}{sid} eq "new") {
my $forum = WebGUI::Forum->create({
masterForumId=>$_[0]->get("forumId"),
forumId=>"new"
});
$hash{forumId} = $forum->get("forumId");
$hash{username} = $session{form}{visitorName} || $session{user}{alias}; $hash{username} = $session{form}{visitorName} || $session{user}{alias};
$hash{userId} = $session{user}{userId}; $hash{userId} = $session{user}{userId};
$hash{USS_submissionId} = "new"; $hash{USS_submissionId} = "new";
@ -382,7 +388,7 @@ sub www_view {
$var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace")); $var{"date.label"} = WebGUI::International::get(13,$_[0]->get("namespace"));
$var{"by.label"} = WebGUI::International::get(21,$_[0]->get("namespace")); $var{"by.label"} = WebGUI::International::get(21,$_[0]->get("namespace"));
$p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),[],$numResults); $p = WebGUI::Paginator->new(WebGUI::URL::page('func=view&wid='.$_[0]->get("wobjectId")),[],$numResults);
$p->setDataByQuery("select USS_submissionId, content, title, userId, status, image, dateSubmitted, username $p->setDataByQuery("select USS_submissionId, content, title, userId, status, image, dateSubmitted, username, forumId
from USS_submission where wobjectId=".$_[0]->get("wobjectId")." and $constraints order by dateSubmitted desc"); from USS_submission where wobjectId=".$_[0]->get("wobjectId")." and $constraints order by dateSubmitted desc");
$page = $p->getPageData; $page = $p->getPageData;
$i = 0; $i = 0;
@ -399,8 +405,8 @@ sub www_view {
$thumbnail = ""; $thumbnail = "";
$imageURL; $imageURL;
} }
($responses) = WebGUI::SQL->quickArray("select count(*) from discussion ($responses) = WebGUI::SQL->quickArray("select count(*) from forumPost left join forumThread on
where wobjectId=".$_[0]->get("wobjectId")." and subId=".$row->{USS_submissionId}); forumThread.forumThreadId=forumPost.forumThreadId where forumThread.forumId=".$row->{forumId});
push (@submission,{ push (@submission,{
"submission.id"=>$page->[$i]->{USS_submissionId}, "submission.id"=>$page->[$i]->{USS_submissionId},
"submission.url"=>WebGUI::URL::page('wid='.$_[0]->get("wobjectId").'&func=viewSubmission&sid='.$page->[$i]->{USS_submissionId}), "submission.url"=>WebGUI::URL::page('wid='.$_[0]->get("wobjectId").'&func=viewSubmission&sid='.$page->[$i]->{USS_submissionId}),