fixing some typos. also the File/Storage bug. also fixing the changelogs.

This commit is contained in:
Matthew Wilson 2006-01-03 05:12:51 +00:00
parent 21188e7949
commit e4bf3c60b0
6 changed files with 24 additions and 27 deletions

View file

@ -1,8 +1,6 @@
6.9.0
- Converted WebGUI to use a new object oriented session system. More details
in migation.txt.
- fix [ 1379384 ] image uploads to non-public pages
- fixed a problem with SynchFileToLDAP hourly script.
6.8.4
@ -10,7 +8,7 @@
ilance.nl)
- fix [ 1379915 ] Survey can only be completed once per user
- Fixed broken UI Level examples in the config file.
- fixed a bug in SyncProfilesToLDAP
- fixed a bug in SyncProfilesToLDAP script
- fix [ 1387242 ] uploadsHandler fails
- fix [ 1389086 ] 6.8.3 RichEdit buttons disappear
- fix [ 1379915 ] Survey can only be completed once per user
@ -20,6 +18,7 @@
- fix [ 1387505 ] Hover help not working on Matrix
- fix [ 1393867 ] Data Form Not Emailing
- fix [ 1392643 ] 2006 Calendar dates are not correct?
- fix [ 1384794 ] editSave on an existing File or Image asset loses storageId.
- Removed the If macro, since it was scheduled for removal in 6.8.0.

View file

@ -67,8 +67,8 @@ sub contentHandler {
### Open new or existing user session based on user-agent's cookie.
my $session = WebGUI::Session->open($s->dir_config('WebguiRoot'),$r->dir_config('WebguiConfig'),$r, $s);
### form variables
foreach ($session{req}->param) {
$session{form}{$_} = $session{req}->body($_) || $session{req}->param($_);
foreach ($session->{_request}->param) {
$session{form}{$_} = $session->{_request}->body($_) || $session->{_request}->param($_);
}
if ($session->env->get("HTTP_X_MOZ") eq "prefetch") { # browser prefetch is a bad thing
$session->http->setStatus("403","We don't allow prefetch, because it increases bandwidth, hurts stats, and can break web sites.");
@ -114,8 +114,8 @@ sub page {
$method = "view";
}
}
$output = tryAssetMethod($asset,$method);
$output = tryAssetMethod($asset,"view") unless ($method eq "view" || $output);
$output = tryAssetMethod($session,$asset,$method);
$output = tryAssetMethod($session,$asset,"view") unless ($method eq "view" || $output);
}
}
if ($output eq "") {
@ -167,14 +167,15 @@ sub setup {
#-------------------------------------------------------------------
sub tryAssetMethod {
my $session = shift;
my $asset = shift;
my $method = shift;
$session{asset} = $asset;
my $methodToTry = "www_".$method;
my $output = eval{$asset->$methodToTry()};
if ($@) {
WebGUI::ErrorHandler::warn("Couldn't call method ".$method." on asset for url: ".$session{requestedUrl}." Root cause: ".$@);
$output = tryAssetMethod($asset,'view') if ($method ne "view");
$session->errorHandler->warn("Couldn't call method ".$method." on asset for url: ".$session{requestedUrl}." Root cause: ".$@);
$output = tryAssetMethod($session,$asset,'view') if ($method ne "view");
}
return $output;
}

View file

@ -198,13 +198,13 @@ sub processPropertiesFromFormPost {
delete $self->{_storageLocation};
my $storage = $self->getStorageLocation;
my $filename = $storage->addFileFromFormPost("file",1);
if (defined $filename) {
if (defined $filename && $filename ne $self->get("filename")) {
my %data;
$data{filename} = $filename;
$data{storageId} = $storage->getId;
$data{title} = $filename unless ($self->session->form->process("title"));
$data{menuTitle} = $filename unless ($self->session->form->process("menuTitle"));
$data{url} = $self->getParent->get('url').'/'.$filename unless ($self->session->form->process("url"));
$data{title} = $filename unless ($session{form}{title});
$data{menuTitle} = $filename unless ($session{form}{menuTitle});
$data{url} = $self->getParent->get('url').'/'.$filename unless ($session{form}{url});
$self->update(\%data);
}
}

View file

@ -18,7 +18,6 @@ use DBI;
use Exporter;
use strict;
use Tie::IxHash;
use WebGUI::ErrorHandler;
use WebGUI::Id;
use WebGUI::Session;
use WebGUI::Utility;
@ -301,7 +300,8 @@ Returns an error code for the current handler.
=cut
sub errorCode {
return $self->dbh->err;
my $self = shift;
return $self->dbh->err;
}
@ -314,7 +314,8 @@ Returns a text error message for the current handler.
=cut
sub errorMessage {
return $self->dbh->errstr;
my $self = shift;
return $self->dbh->errstr;
}
@ -644,7 +645,7 @@ sub setRow {
my ($self, $table, $keyColumn, $data, $id) = @_;
if ($data->{$keyColumn} eq "new" || $id) {
$data->{$keyColumn} = $id || WebGUI::Id::generate();
$self->write("insert into $table ($keyColumn) values (".$self->quote($data->{$keyColumn}).")", $dbh);
$self->write("insert into $table ($keyColumn) values (".$self->quote($data->{$keyColumn}).")");
}
my (@pairs);
foreach my $key (keys %{$data}) {
@ -653,7 +654,7 @@ sub setRow {
}
}
if ($pairs[0] ne "") {
$self->write("update $table set ".join(", ", @pairs)." where ".$keyColumn."=".$self->quote($data->{$keyColumn}), $dbh);
$self->write("update $table set ".join(", ", @pairs)." where ".$keyColumn."=".$self->quote($data->{$keyColumn}));
}
return $data->{$keyColumn};
}

View file

@ -39,7 +39,7 @@ Package WebGUI::Session
=head1 DESCRIPTION
This package is the heart and lifeblood of WebGUI; it is the glue that holds WebGUI together. When you create a session object, you'll immidiately have access to all sorts of other objects. By passing the session object around in code you'll have access to the default database connection, error handler, user and more without having to create it each time. The lends much speed to WebGUI.
This package is the heart and lifeblood of WebGUI; it is the glue that holds WebGUI together. When you create a session object, you'll immediately have access to all sorts of other objects. By passing the session object around in code you'll have access to the default database connection, error handler, user and more without having to create it each time. The lends much speed to WebGUI.
B<NOTE:> It is important to distinguish the difference between a WebGUI session and a user session. A user session is just part of a WebGUI session. A WebGUI session is all of the basic data the WebGUI needs to operate.
@ -204,7 +204,7 @@ sub errorHandler {
unless (exists $self->{_errorHandler}) {
$self->{_errorHandler} = WebGUI::Session::ErrorHandler->new($self);
}
return $self-{_errorHandler};
return $self->{_errorHandler};
}
#-------------------------------------------------------------------

View file

@ -203,14 +203,9 @@ sub addFileFromFormPost {
my $attachmentCount = 1;
foreach my $upload ($session{req}->upload($formVariableName)) {
return $filename if $attachmentCount > $attachmentLimit;
my $tempPath = $upload->tempname();
$filename = $upload->filename();
next unless $filename;
if ($tempPath =~ /([^\/\\]+)$/) {
$filename = $1;
} else {
$filename = $tempPath;
}
if ($filename =~ /([^\/\\]+)$/) { $filename = $1; }
my $type = $self->getFileExtension($filename);
if (isIn($type, qw(pl perl sh cgi php asp))) { # make us safe from malicious uploads
$filename =~ s/\./\_/g;
@ -233,7 +228,8 @@ sub addFileFromFormPost {
return undef;
}
}
return $filename;
return $filename if $filename;
return undef;
}