many bug fixes

This commit is contained in:
JT Smith 2005-03-24 14:47:57 +00:00
parent c3273e1d53
commit b84ae38958
15 changed files with 88 additions and 97 deletions

View file

@ -163,6 +163,8 @@ sub editSave {
$data{className} = $className;
$data{storageId} = $storage->getId;
$data{filename} = $data{title} = $data{menuTitle} = $filename;
$data{templateId} = 'PBtmpl0000000000000024';
$data{templateId} = 'PBtmpl0000000000000088' if ($className eq "WebGUI::Asset::File::Image");
$data{url} = $class->getParent->getUrl.'/'.$filename;
my $newAsset = $class->getParent->addChild(\%data);
$newAsset->setSize($storage->getFileSize($filename));

View file

@ -469,27 +469,16 @@ sub rate {
#-------------------------------------------------------------------
=head2 setLastPost ( lastPostDate, lastPostId )
=head2 setStatusApproved ( )
Sets the pertinent details for the last post. Can also be done directly using the set method.
=head3 lastPostDate
The epoch date of the post.
=head3 lastPostId
The unique id of the post.
Sets the post to approved and sends any necessary notifications.
=cut
sub setLastPost {
my ($self, $postDate, $postId) = @_;
$self->update({
lastPostId=>$postId,
lastPostDate=>$postDate
});
$self->getParent->setLastPost($postDate, $postId);
sub setStatusApproved {
my $self = shift;
$self->SUPER::setStatusApproved;
$self->getParent->incrementThreads($self->get("dateUpdated"),$self->getId) unless ($self->isReply);
}

View file

@ -137,7 +137,10 @@ Returns the TabForm object that will be used in generating the edit page for thi
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
# $tabform->getTab("properties")->raw('<input type="hidden" name="op2" value="'.$session{form}{afterEdit}.'" />');
$tabform->hidden({
name=>"returnUrl",
value=>$session{form}{returnUrl}
});
if ($self->getValue("namespace") eq "") {
my $namespaces = WebGUI::SQL->buildHashRef("select distinct(namespace),namespace
from template order by namespace");
@ -334,6 +337,14 @@ sub www_edit {
return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get('edit template', 'Template'));
}
#-------------------------------------------------------------------
sub www_goBackToPage {
my $self = shift;
WebGUI::HTTP::setRedirect($session{form}{returnUrl}) if ($session{form}{returnUrl});
return "";
}
#-------------------------------------------------------------------
sub www_manage {
my $self = shift;

View file

@ -755,31 +755,6 @@ sub recalculateRating {
}
#-------------------------------------------------------------------
=head2 setLastPost ( lastPostDate, lastPostId )
Sets the pertinent details for the last post. Can also be done directly using the set method.
=head3 lastPostDate
The epoch date of the post.
=head3 lastPostId
The asset id of the post.
=cut
sub setLastPost {
my ($self, $postDate, $postId) = @_;
$self->update({
lastPostId=>$postId,
lastPostDate=>$postDate
});
}
#-------------------------------------------------------------------
=head2 subscribe ( )

View file

@ -165,6 +165,8 @@ sub view {
type=>$child->getName,
url=>$child->getUrl,
isImage=>$isImage,
canEdit=>$child->canEdit,
controls=>$child->getToolbar,
isFile=>$isFile,
"thumbnail.url"=>$thumbnail,
"file.url"=>$file

View file

@ -81,6 +81,10 @@ sub getEditForm {
-value=>$self->getValue('templateId'),
-namespace=>"Navigation"
);
$tabform->hidden({
name=>"returnUrl",
value=>$session{form}{returnUrl}
});
my ($descendantsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
my @assetsToInclude = split("\n",$self->getValue("assetsToInclude"));
my $afterScript;
@ -239,7 +243,11 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
if ($self->getToolbarState) {
my $toolbar = editIcon('func=edit',$self->get("url"));
my $returnUrl;
if (exists $session{asset}) {
$returnUrl = "&proceed=goBackToPage&returnUrl=".WebGUI::URL::escape($session{asset}->getUrl);
}
my $toolbar = editIcon('func=edit'.$returnUrl,$self->get("url"));
return '<img src="'.$self->getIcon(1).'" border="0" title="'.$self->getName.'" alt="'.$self->getName.'" align="absmiddle">'.$toolbar;
}
return $self->SUPER::getToolbar();
@ -388,6 +396,14 @@ sub www_edit {
}
#-------------------------------------------------------------------
sub www_goBackToPage {
my $self = shift;
WebGUI::HTTP::setRedirect($session{form}{returnUrl}) if ($session{form}{returnUrl});
return "";
}
#-------------------------------------------------------------------
# we eventually should reaadd this
sub www_preview {