preparing for 7.0.5 release

fixed some bugs
This commit is contained in:
JT Smith 2006-08-09 16:09:17 +00:00
parent 3000fccb79
commit dfe92a73e2
7 changed files with 97 additions and 20 deletions

View file

@ -1386,8 +1386,11 @@ sub new {
my $class = shift;
my $session = shift;
my $assetId = shift;
return undef unless ($assetId);
my $className = shift;
unless (defined $assetId) {
$session->errorHandler->error("Asset constructor new() requires an assetId.");
return undef;
}
my $assetRevision = $session->stow->get("assetRevision");
my $revisionDate = shift || $assetRevision->{$assetId}{$session->scratch->get("versionTag")||'_'};
unless ($revisionDate) {

View file

@ -67,6 +67,73 @@ sub checkExportPath {
return $error;
}
#-------------------------------------------------------------------
=head2 exportAsHtml
Same as www_exportGenerate except without the output. Returns "success" if successful, otherwise returns an error message.
=cut
sub exportAsHtml {
my $self = shift;
my $error = $self->checkExportPath();
if ($error) {
return $error;
}
my $userId = '1';
my $index = "index.html";
# Change the stuff we need to change to do the export
my $newSession = WebGUI::Session->open($self->session->config->getWebguiRoot, $self->session->config->getFilename);
my $newSelf = WebGUI::Asset->new($newSession, $self->getId, $self->get("className"), $self->get("revisionDate"));
my $assets = $newSelf->getLineage(["self","descendants"],{returnObjects=>1,endingLineageLength=>$newSelf->getLineageLength+$self->session->form->process("depth")});
$newSession->user({userId=>$userId});
foreach my $asset (@{$assets}) {
my $url = $asset->get("url");
unless ($asset->canView($userId)) {
next;
}
my $path;
my $filename;
if ($url =~ /\./) {
$url =~ /^(.*)\/(.*)$/;
$path = $1;
$filename = $2;
if ($filename eq "") {
$filename = $path;
$path = undef;
}
} else {
$path = $url;
$filename = $index;
}
if($path) {
$path = $self->session->config->get("exportPath") . "/" . $path;
eval { mkpath($path) };
if($@) {
return "Couldn't create path";
}
}
$path .= "/".$filename;
my $file = eval { FileHandle->new(">".$path) or die "$!" };
if ($@) {
return "couldn't open path";
} else {
$newSession->output->setHandle($file);
my $content = $asset->www_view;
unless ($content eq "chunked") {
$newSession->output->print($content);
}
$file->close;
}
}
$newSession->var->end;
$newSession->close;
return "success";
}
#-------------------------------------------------------------------

View file

@ -403,6 +403,8 @@ sub send {
}
}
}
# due to the large number of emails that may be generated by sending emails to a group,
# emails to members of a group are queued rather than sent directly
my $group = $self->{_toGroup};
delete $self->{_toGroup};
if ($group) {
@ -413,9 +415,7 @@ sub send {
my $user = WebGUI::User->new($self->session, $userId);
if ($user->profileField("email")) {
$self->{_message}->head->replace("To",$user->profileField("email"));
unless ($self->send) {
$status = 0;
}
$self->queue;
}
}
}

View file

@ -71,8 +71,10 @@ sub execute {
my $self = shift;
my $versionTag = shift;
foreach my $asset (@{$versionTag->getAssets}) {
$asset->exportAsHtml();
$asset->getContainer->exportAsHtml();
my $status = $asset->exportAsHtml();
return $self->ERROR unless ($status eq "success");
$status = $asset->getContainer->exportAsHtml();
return $self->ERROR unless ($status eq "success");
}
return $self->COMPLETE;
}