more bug fixes

This commit is contained in:
JT Smith 2005-02-23 20:42:09 +00:00
parent 1dc555e078
commit 7e0a5b13b9
8 changed files with 37 additions and 14 deletions

View file

@ -1014,12 +1014,7 @@ while (my ($id, $template, $namespace) = $sth->array) {
$template =~ s/back\.url/collaboration.url/ixsg;
$template =~ s/submissions_loop/post_loop/ixsg;
$template = '<a name="<tmpl_var assetId>"></a> <tmpl_if session.var.adminOn> <p><tmpl_var controls></p> </tmpl_if>'.$template;
my $replies = '<a name="<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
<p><tmpl_var controls></p>
</tmpl_if>
my $replies = '<tmpl_if user.canReply>
<style>
.postBorder {
border: 1px solid #cccccc;
@ -1325,7 +1320,9 @@ while (my ($id, $template, $namespace) = $sth->array) {
<a href="<tmpl_var subscribe.url>">[<tmpl_var subscribe.label>]</a>
</tmpl_if>
</tmpl_unless>
</div>';
</div>
</tmpl_if>
';
$template =~ s/<tmpl_var\s+replies>/$replies/ixsg;
WebGUI::SQL->write("update template set template=".quote($template).", namespace=".quote($newNamespace)." where templateId=".quote($id)." and namespace=".quote($namespace));
}
@ -1521,7 +1518,11 @@ while (my ($id, $desc) = $sth->array) {
WebGUI::SQL->write("update wobject set description=".quote(replaceMacros($desc))." where assetId=".quote($id));
}
$sth->finish;
my $sth = WebGUI::SQL->read("select assetId, content from Post");
while (my ($id, $desc) = $sth->array) {
WebGUI::SQL->write("update Post set content=".quote(replaceMacros($desc))." where assetId=".quote($id));
}
$sth->finish;
my $sth = WebGUI::SQL->read("select assetId, snippet from snippet");
while (my ($id, $snip) = $sth->array) {
WebGUI::SQL->write("update snippet set snippet=".quote(replaceMacros($snip))." where assetId=".quote($id));

View file

@ -1534,7 +1534,7 @@ sub hasChildren {
} elsif (exists $self->{_lastChild}) {
$self->{_hasChildren} = 1;
} else {
my ($hasChildren) = WebGUI::SQL->read("select count(*) from asset where parentId=".quote($self->getId));
my ($hasChildren) = WebGUI::SQL->quickArray("select count(*) from asset where parentId=".quote($self->getId));
$self->{_hasChildren} = $hasChildren;
}
}
@ -1832,6 +1832,7 @@ sub processTemplate {
if (defined $template) {
return $template->process(\%vars);
} else {
WebGUI::ErrorHandler::warn("Can't instanciate template $templateId for asset ".$self->getId);
return "Error: Can't instanciate template ".$templateId;
}
}

View file

@ -99,10 +99,10 @@ sub duplicate {
sub getBox {
my $self = shift;
my %var;
$var{"attachment.icon"} = $self->getFileIcon;
$var{"attachment.icon"} = $self->getFileIconUrl;
$var{"attachment.url"} = $self->getFileUrl;
$var{"attachment.name"} = $self->get("filename");
$var{"attachment.size"} = $self->getStorageLocation->getSize;
$var{"attachment.size"} = $self->getStorageLocation->getFileSize;
$var{"attachment.type"} = $self->getStorageLocation->getFileExtension;
return $self->processTemplate(\%var,"PBtmpl0000000000000003");
}

View file

@ -107,6 +107,7 @@ sub definition {
sub DESTROY {
my $self = shift;
return unless defined $self;
$self->{_next}->DESTROY if (exists $self->{_next});
$self->{_previous}->DESTROY if (exists $self->{_previous});
$self->SUPER::DESTROY;

View file

@ -140,7 +140,7 @@ sub view {
foreach my $child (@{$children}) {
if (ref $child eq "WebGUI::Asset::File") {
$var{"attachment.box"} = $child->getBox;
$var{"attachment.icon"} = $child->getFileIcon;
$var{"attachment.icon"} = $child->getFileIconUrl;
$var{"attachment.url"} = $child->getFileUrl;
$var{"attachment.name"} = $child->get("filename");
} elsif (ref $child eq "WebGUI::Asset::File::Image") {

View file

@ -341,11 +341,11 @@ sub view {
# these next two variables can be very inefficient, consider getting rid of them
my $parentsFirstChild = $parent->getFirstChild;
if (defined $parentsFirstChild) {
$pageData->{"page.isRankedFirst"} = ($asset->getId == $parentsFirstChild->getId);
$pageData->{"page.isRankedFirst"} = ($asset->getId eq $parentsFirstChild->getId);
}
my $parentsLastChild = $parent->getLastChild;
if (defined $parentsLastChild) {
$pageData->{"page.isRankedLast"} = ($asset->getId == $parentsLastChild->getId);
$pageData->{"page.isRankedLast"} = ($asset->getId eq $parentsLastChild->getId);
}
}
push(@{$var->{page_loop}}, $pageData);

View file

@ -106,6 +106,25 @@ sub generateThumbnail {
#-------------------------------------------------------------------
=head2 getFiles ( )
Returns an array reference of the files in this storage location.
=cut
sub getFiles {
my $self = shift;
my $files = $self->SUPER::getFiles;
my @newFiles;
foreach my $file (@{$files}) {
next if $file =~ /^thumb-/;
push (@newFiles,$file);
}
return \@newFiles;
}
#-------------------------------------------------------------------
=head2 getThumbnailUrl ( filename )

View file

@ -445,3 +445,4 @@ function dragable_getContentMap() {
}
return contentMap;
}