bunch of bug fixes

This commit is contained in:
JT Smith 2005-03-17 02:45:12 +00:00
parent 62fdfa2e3f
commit 021f5c38fb
8 changed files with 50 additions and 13 deletions

View file

@ -15,6 +15,7 @@ use Tie::CPHash;
use WebGUI::Asset;
use WebGUI::Asset::Template;
use WebGUI::Asset::Post::Thread;
use WebGUI::Cache;
use WebGUI::DateTime;
use WebGUI::Grouping;
use WebGUI::HTML;
@ -665,6 +666,9 @@ sub processPropertiesFromFormPost {
$storage->generateThumbnail($filename);
}
$session{form}{proceed} = "redirectToParent";
# clear some cache
WebGUI::Cache->new("wobject_".$self->getThread->getParent->getId."_".$session{user}{userId})->delete;
WebGUI::Cache->new("cspost_".($self->getParent->getId)."_".$session{user}{userId}."_".$session{scratch}{discussionLayout}."_1")->delete;
}
@ -840,6 +844,9 @@ sub www_edit {
$self->{_thread} = $self->getParent->getThread;
return WebGUI::Privilege::insufficient() unless ($self->getThread->canReply);
$var{isReply} = 1;
$var{'reply.title'} = $self->getParent->get("title");
$var{'reply.synopsis'} = $self->getParent->get("synopsis");
$var{'reply.content'} = $self->getParent->formatContent;
unless ($session{form}{content} || $session{form}{title}) {
$content = "[quote]".$self->getParent->get("content")."[/quote]" if ($session{form}{withQuote});
$title = $self->getParent->get("title");

View file

@ -608,12 +608,14 @@ sub view {
} else {
$sql .= "asset.lineage";
}
$p->setDataByQuery($sql);
my $currentPageUrl = $session{env}{PATH_INFO};
$currentPageUrl =~ s/^\///;
$p->setDataByQuery($sql, undef, undef, undef, "url", $currentPageUrl);
foreach my $dataSet (@{$p->getPageData()}) {
my $reply = WebGUI::Asset::Post->newByPropertyHashRef($dataSet);
$reply->{_thread} = $self; # caching thread for better performance
my %replyVars = %{$reply->getTemplateVars};
$replyVars{isCurrent} = ('/'.$reply->get("url") eq $session{env}{PATH_INFO});
$replyVars{isCurrent} = ($reply->get("url") eq $currentPageUrl);
$replyVars{isThreadRoot} = $self->getId eq $reply->getId;
$replyVars{depth} = $reply->getLineageLength - $self->getLineageLength;
$replyVars{depthX10} = $replyVars{depth}*10;

View file

@ -569,7 +569,7 @@ sub www_view {
my $cache;
my $output;
my $useCache = (
$session{form}{op} eq "" &&
$session{form}{op} eq "" && $session{form}{pn} eq "" &&
(
( $self->get("cacheTimeout") > 10 && $session{user}{userId} ne '1') ||
( $self->get("cacheTimeoutVisitor") > 10 && $session{user}{userId} eq '1')

View file

@ -346,23 +346,23 @@ sub definition {
},
notificationTemplateId =>{
fieldType=>"template",
defaultValue=>undef
defaultValue=>'PBtmpl0000000000000027'
},
searchTemplateId =>{
fieldType=>"template",
defaultValue=>undef
defaultValue=>'PBtmpl0000000000000031'
},
postFormTemplateId =>{
fieldType=>"template",
defaultValue=>undef
defaultValue=>'PBtmpl0000000000000029'
},
threadTemplateId =>{
fieldType=>"template",
defaultValue=>undef
defaultValue=>'PBtmpl0000000000000032'
},
collaborationTemplateId =>{
fieldType=>"template",
defaultValue=>undef
defaultValue=>'PBtmpl0000000000000026'
},
karmaPerPost =>{
fieldType=>"integer",

View file

@ -476,7 +476,7 @@ sub setDataByArrayRef {
#-------------------------------------------------------------------
=head2 setDataByQuery ( query [, dbh, unconditional, placeholders ] )
=head2 setDataByQuery ( query [, dbh, unconditional, placeholders, dynamicPageNumberKey, dynamicPageNumberValue ] )
Retrieves a data set from a database and replaces whatever data set was passed in through the constructor.
@ -498,11 +498,19 @@ A boolean indicating that the query should be read unconditionally. Defaults to
An array reference containing a list of values to be used in the placeholders defined in the SQL statement.
=head3 dynamicPageNumberKey
One of the field names being returned from this query. If this is set, the paginator will dynamically assign a page number based upon this key matching the dynamicPageNumberValue. Note that this only applies if the default page number is 1.
=head3 dynamicPageNumberValue
A value to match the dynamicPageNumberKey.
=cut
sub setDataByQuery {
my ($sth, $rowCount, @row);
my ($self, $sql, $dbh, $unconditional, $placeholders) = @_;
my ($self, $sql, $dbh, $unconditional, $placeholders, $dynamicPageNumberKey, $dynamicPageNumberValue) = @_;
$dbh ||= WebGUI::SQL->getSlave;
if ($unconditional) {
$sth = WebGUI::SQL->unconditionalRead($sql,$dbh,$placeholders);
@ -510,6 +518,7 @@ sub setDataByQuery {
} else {
$sth = WebGUI::SQL->read($sql,$dbh,$placeholders);
}
my $defaultPageNumber = $self->getPageNumber;
$self->{_totalRows} = $sth->rows;
$self->{_columnNames} = [ $sth->getColumnNames ];
my $pageCount = 1;
@ -518,10 +527,18 @@ sub setDataByQuery {
if ($rowCount/$self->{_rpp} > $pageCount) {
$pageCount++;
}
if ($pageCount == $self->getPageNumber) {
push(@row,$data);
if (defined $dynamicPageNumberKey && $defaultPageNumber == 1) {
if ($data->{$dynamicPageNumberKey} eq $dynamicPageNumberValue) {
$self->{_pn} = $pageCount;
$dynamicPageNumberKey = undef;
}
push(@row,$data);
} else {
push(@row,{});
if ($pageCount == $self->getPageNumber) {
push(@row,$data);
} else {
push(@row,{});
}
}
}
$sth->finish;

View file

@ -1,6 +1,11 @@
package WebGUI::i18n::English::WebGUI;
our $I18N = {
'304' => {
message => q|Language|,
lastUpdated => 1031514049
},
'559' => {
message => q|Run On Registration|,
lastUpdated => 1031514049