lots of bug fixes
|
|
@ -137,7 +137,7 @@ WebGUI::SQL->write("alter table EventsCalendar_event add column eventLocation te
|
|||
WebGUI::SQL->write("alter table EventsCalendar_event change column startDate eventStartDate bigint(20)");
|
||||
WebGUI::SQL->write("alter table EventsCalendar_event change column endDate eventEndDate bigint(20)");
|
||||
WebGUI::SQL->write("alter table EventsCalendar_event add column templateId varchar(22)");
|
||||
WebGUI::SQL->write("alter table EventsCalendar_event add column assetId varchar(22)");
|
||||
WebGUI::SQL->write("alter table EventsCalendar_event add column assetId varchar(22) not null");
|
||||
WebGUI::SQL->write("alter table EventsCalendar_event drop primary key");
|
||||
|
||||
|
||||
|
|
@ -1152,7 +1152,7 @@ sub walkTree {
|
|||
$wobject->{startDate}, $wobject->{endDate}, $wobject->{ownerId}, $wobject->{groupIdEdit},
|
||||
$page->{styleId}, $page->{printableStyleId});
|
||||
}
|
||||
rmtree($session{config}{uploadsPath}.'/'.$wobject->{wobjectId});
|
||||
rmtree($session{config}{uploadsPath}.$session{os}{slash}.$wobject->{wobjectId});
|
||||
} elsif ($wobject->{namespace} eq "SiteMap") {
|
||||
print "\t\t\tConverting SiteMap ".$wobject->{wobjectId}." into Navigation\n" unless ($quiet);
|
||||
my ($starturl) = WebGUI::SQL->quickArray("select urlizedTitle from page
|
||||
|
|
@ -1169,9 +1169,9 @@ sub walkTree {
|
|||
WebGUI::SQL->write("update wobject set namespace='Navigation' where assetId=".quote($wobjectId));
|
||||
} elsif ($wobject->{namespace} eq "FileManager") {
|
||||
print "\t\t\tConverting File Manager ".$wobject->{wobjectId}." into File Folder Layout\n" unless ($quiet);
|
||||
WebGUI::SQL->write("update asset set className='WebGUI::Asset::Layout' where assetId=".quote($wobjectId));
|
||||
WebGUI::SQL->write("insert into Layout (assetId,templateId) values (".quote($wobjectId).", '15')");
|
||||
WebGUI::SQL->write("update wobject set namespace='Layout' where wobjectId=".quote($wobject->{wobjectId}));
|
||||
WebGUI::SQL->write("update asset set className='WebGUI::Asset::Folder' where assetId=".quote($wobjectId));
|
||||
WebGUI::SQL->write("insert into Folder (assetId,templateId) values (".quote($wobjectId).", '15')");
|
||||
WebGUI::SQL->write("update wobject set namespace='Folder' where wobjectId=".quote($wobject->{wobjectId}));
|
||||
print "\t\t\tMigrating attachments for File Manager ".$wobject->{wobjectId}."\n" unless ($quiet);
|
||||
my $sth = WebGUI::SQL->read("select * from FileManager_file where wobjectId=".quote($wobjectId)." order by sequenceNumber");
|
||||
my $rank = 1;
|
||||
|
|
@ -1206,7 +1206,7 @@ sub walkTree {
|
|||
}
|
||||
}
|
||||
$sth->finish;
|
||||
rmtree($session{config}{uploadsPath}.'/'.$wobject->{wobjectId});
|
||||
rmtree($session{config}{uploadsPath}.$session{os}{slash}.$wobject->{wobjectId});
|
||||
} elsif ($wobject->{namespace} eq "Product") {
|
||||
print "\t\t\tMigrating information for Product ".$wobject->{wobjectId}."\n" unless ($quiet);
|
||||
my ($newProductStoreId);
|
||||
|
|
@ -1269,8 +1269,6 @@ sub walkTree {
|
|||
0, 0, ".quote($master->{archiveAfter}||31536000).", ".quote($master->{postsPerPage}||10).",
|
||||
".quote($namespace->{submissionsPerPage}).", ".quote($sg->groupId).",
|
||||
".quote($wobject->{allowDiscussion}).")");
|
||||
#count threads, views, replies
|
||||
#find last post
|
||||
WebGUI::SQL->write("update wobject set namespace='Collaboration' where wobjectId=".quote($wobject->{wobjectId}));
|
||||
print "\t\t\tMigrating submissions for USS ".$wobject->{wobjectId}."\n" unless ($quiet);
|
||||
my $ussId = $namespace->{USS_id};
|
||||
|
|
@ -1379,6 +1377,13 @@ sub walkTree {
|
|||
rating=>$post->{rating}
|
||||
},undef,$postId);
|
||||
$postRank++;
|
||||
if ($submission->{image}) {
|
||||
my $storageId = copyFile($submission->{image},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId});
|
||||
copyFile('thumb-'.$submission->{image},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId},$storageId);
|
||||
}
|
||||
if ($submission->{attachment}) {
|
||||
my $storageId = copyFile($submission->{attachment},$wobject->{wobjectId}.$session{os}{slash}.$submission->{USS_submissionId});
|
||||
}
|
||||
}
|
||||
$posts->finish;
|
||||
WebGUI::SQL->setRow("Thread","assetId",{
|
||||
|
|
@ -1394,6 +1399,7 @@ sub walkTree {
|
|||
$oldestForumPost{id} = $oldestThreadPost{id};
|
||||
}
|
||||
}
|
||||
rmtree($session{config}{uploadsPath}.$session{os}{slash}.$wobject->{wobjectId});
|
||||
WebGUI::SQL->setRow("Collaboration","assetId",{
|
||||
assetId=>$wobjectId,
|
||||
lastPostId=>$oldestForumPost{id},
|
||||
|
|
@ -1402,8 +1408,6 @@ sub walkTree {
|
|||
views=>$collabViewCounter,
|
||||
threads=>$collabThreadCounter
|
||||
});
|
||||
# migrate submission attachments
|
||||
# migrate submission images
|
||||
} elsif ($wobject->{namespace} eq "WobjectProxy") {
|
||||
WebGUI::SQL->write("update WobjectProxy set description=".quote($wobject->{description})." where
|
||||
assetId=".quote($wobjectId));
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ INSERT INTO template VALUES ('1','Default Page','<a href=\"<tmpl_var assetId>\">
|
|||
INSERT INTO template VALUES ('1','File','<tmpl_if session.var.adminOn>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n<a href=\"<tmpl_var fileUrl>\"><img src=\"<tmpl_var fileIcon>\" alt=\"<tmpl_var title>\" border=\"0\" /><tmpl_var filename></a>','FileAsset',1,1);
|
||||
INSERT INTO template VALUES ('2','Image','<tmpl_if session.var.adminOn>\r\n<p><tmpl_var controls></p>\r\n</tmpl_if>\r\n<img src=\"<tmpl_var fileUrl>\" <tmpl_var parameters> />','ImageAsset',1,1);
|
||||
|
||||
INSERT INTO template VALUES ('15','File Folder','<a name=\"<tmpl_var assetId>\"></a><tmpl_if session.var.adminOn>\r\n <p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" class=\"content\">\r\n<tmpl_loop subfolder_loop>\r\n<tr>\r\n <td class=\"tableData\" valign=\"top\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a> <a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n<td valign=\"top\" colspan=\"3\"><tmpl_var synopsis></td></tr>\r\n</tmpl_loop>\r\n<tmpl_loop file_loop>\r\n<tr>\r\n <td valign=\"top\" class=\"tableData\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a> <a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var synopsis></td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var type></td>\r\n <td class=\"tableData\" valign=\"top\">^D(\"%z %Z\",<tmpl_var date.epoch>);</td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var size></td>\r\n</tr>\r\n</tmpl_loop>\r\n\r\n</table>', 'Folder',1,1);
|
||||
INSERT INTO template VALUES ('15','File Folder','<a name=\"<tmpl_var assetId>\"></a><tmpl_if session.var.adminOn>\r\n <p><tmpl_var controls></p>\r\n</tmpl_if>\r\n\r\n<tmpl_if displayTitle>\r\n <h1><tmpl_var title></h1>\r\n</tmpl_if>\r\n\r\n<tmpl_if description>\r\n <p><tmpl_var description></p>\r\n</tmpl_if>\r\n\r\n<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" class=\"content\">\r\n<tmpl_loop subfolder_loop>\r\n<tr>\r\n <td class=\"tableData\" valign=\"top\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a> <a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n<td valign=\"top\" colspan=\"3\"><tmpl_var synopsis></td></tr>\r\n</tmpl_loop>\r\n<tmpl_loop file_loop>\r\n<tr>\r\n <td valign=\"top\" class=\"tableData\"><a href=\"<tmpl_var url>\"><img src=\"<tmpl_var icon.small>\" border=\"0\" alt=\"<tmpl_var title>\"></a> <a href=\"<tmpl_var url>\"><tmpl_var title></td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var synopsis></td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var synopsis></td>\r\n <td class=\"tableData\" valign=\"top\">^D(\"%z %Z\",<tmpl_var date.epoch>);</td>\r\n <td class=\"tableData\" valign=\"top\"><tmpl_var size></td>\r\n</tr>\r\n</tmpl_loop>\r\n\r\n</table>', 'Folder',1,1);
|
||||
|
||||
alter table HttpProxy add column cookieJarStorageId varchar(22);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,17 +84,13 @@ sub definition {
|
|||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
sub getBox {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
$var{"attachment.icon"} = $self->getFileIcon;
|
||||
$var{"attachment.url"} = $self->getFileUrl;
|
||||
$var{"attachment.name"} = $self->get("filename");
|
||||
$var{"attachment.size"} = $self->getStorageLocation->getSize;
|
||||
$var{"attachment.type"} = $self->getStorageLocation->getFileExtension;
|
||||
return $self->processTemplate(\%var,"PBtmpl0000000000000003");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub DESTROY {
|
||||
my $self = shift;
|
||||
$self->{_storageLocation}->DESTROY if (exists $self->{_storageLocation});
|
||||
$self->SUPER::DESTROY;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -106,6 +102,18 @@ sub duplicate {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getBox {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
$var{"attachment.icon"} = $self->getFileIcon;
|
||||
$var{"attachment.url"} = $self->getFileUrl;
|
||||
$var{"attachment.name"} = $self->get("filename");
|
||||
$var{"attachment.size"} = $self->getStorageLocation->getSize;
|
||||
$var{"attachment.type"} = $self->getStorageLocation->getFileExtension;
|
||||
return $self->processTemplate(\%var,"PBtmpl0000000000000003");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getEditForm ()
|
||||
|
|
@ -170,11 +178,17 @@ sub getName {
|
|||
return "File";
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getStorageLocation {
|
||||
my $self = shift;
|
||||
unless (exists $self->{_storageLocation}) {
|
||||
$self->{_storageLocation} = WebGUI::Storage->get($self->get("storageId"));
|
||||
if ($self->get("storageId") eq "") {
|
||||
$self->{_storageLocation} = WebGUI::Storage->create;
|
||||
$self->update({storageId=>$self->{_storageLocation}->getId});
|
||||
} else {
|
||||
$self->{_storageLocation} = WebGUI::Storage->get($self->get("storageId"));
|
||||
}
|
||||
}
|
||||
return $self->{_storageLocation};
|
||||
}
|
||||
|
|
@ -184,7 +198,7 @@ sub getStorageLocation {
|
|||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
my $storage = $self->{_storageLocation} = WebGUI::Storage->create;
|
||||
my $storage = $self->getStorageLocation->create;
|
||||
my $filename = $storage->addFileFromFormPost("file");
|
||||
if (defined $filename) {
|
||||
my $oldVersions;
|
||||
|
|
@ -203,6 +217,7 @@ sub processPropertiesFromFormPost {
|
|||
$self->update(\%data);
|
||||
$self->setSize($storage->getFileSize($filename));
|
||||
$storage->setPrivileges($self->get("ownerUserId"), $self->get("groupIdView"), $self->get("groupIdEdit"));
|
||||
$self->{_storageLocation} = $storage;
|
||||
} else {
|
||||
$storage->delete;
|
||||
$self->getStorageLocation->setPrivileges($self->get("ownerUserId"), $self->get("groupIdView"), $self->get("groupIdEdit"));
|
||||
|
|
@ -221,14 +236,14 @@ sub purge {
|
|||
my @old = split("\n",$self->get("olderVersions"));
|
||||
foreach my $oldone (@old) {
|
||||
my ($storageId, $filename) = split("|",$oldone);
|
||||
my $storage = WebGUI::Storage->get($storageId);
|
||||
$storage->delete;
|
||||
$self->getStorageLocation->delete;
|
||||
}
|
||||
$self->getStorageLocation->delete;
|
||||
return $self->SUPER::purge;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my %var = %{$self->get};
|
||||
|
|
|
|||
|
|
@ -160,7 +160,12 @@ sub getName {
|
|||
sub getStorageLocation {
|
||||
my $self = shift;
|
||||
unless (exists $self->{_storageLocation}) {
|
||||
$self->{_storageLocation} = WebGUI::Storage::Image->get($self->get("storageId"));
|
||||
if ($self->get("storageId") eq "") {
|
||||
$self->{_storageLocation} = WebGUI::Storage::Image->create;
|
||||
$self->update({storageId=>$self->{_storageLocation}->getId});
|
||||
} else {
|
||||
$self->{_storageLocation} = WebGUI::Storage::Image->get($self->get("storageId"));
|
||||
}
|
||||
}
|
||||
return $self->{_storageLocation};
|
||||
}
|
||||
|
|
@ -168,7 +173,7 @@ sub getStorageLocation {
|
|||
#-------------------------------------------------------------------
|
||||
sub getThumbnailUrl {
|
||||
my $self = shift;
|
||||
return $self->getStorageLocation->getThumbnailUrl;
|
||||
return $self->getStorageLocation->getThumbnailUrl($self->get("filename"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,11 +16,13 @@ package WebGUI::Asset::FilePile;
|
|||
|
||||
use strict;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::File;
|
||||
use WebGUI::Asset::File::Image;
|
||||
use WebGUI::HTTP;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Storage::Image;
|
||||
use WebGUI::TabForm;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
|
@ -140,16 +142,16 @@ sub edit {
|
|||
#-------------------------------------------------------------------
|
||||
sub editSave {
|
||||
my $class = shift;
|
||||
my $parent = WebGUI::Asset->newByUrl;
|
||||
my $tempStorage = WebGUI::Storage->create;
|
||||
$tempStorage->addFileFromFormPost("file");
|
||||
foreach my $filename (@{$tempStorage->getFiles}) {
|
||||
my $storage = WebGUI::Storage->create;
|
||||
my $storage = WebGUI::Storage::Image->create;
|
||||
$storage->addFileFromFilesystem($tempStorage->getPath($filename));
|
||||
$storage->setPrivileges($class->getParent->get("ownerUserId"),$class->getParent->get("groupIdView"),$class->getParent->get("groupIdEdit"));
|
||||
my %data;
|
||||
my $class = 'WebGUI::Asset::File';
|
||||
$class = "WebGUI::Asset::File::Image" if (isIn($storage->getFileExtension($filename),qw(jpg jpeg gif png)));
|
||||
foreach my $definition (@{$class->definition}) {
|
||||
my $className = 'WebGUI::Asset::File';
|
||||
$className = "WebGUI::Asset::File::Image" if ($storage->isImage($filename));
|
||||
foreach my $definition (@{$className->definition}) {
|
||||
foreach my $property (keys %{$definition->{properties}}) {
|
||||
$data{$property} = WebGUI::FormProcessor::process(
|
||||
$property,
|
||||
|
|
@ -158,17 +160,17 @@ sub editSave {
|
|||
);
|
||||
}
|
||||
}
|
||||
$data{className} = $class;
|
||||
$data{className} = $className;
|
||||
$data{storageId} = $storage->getId;
|
||||
$data{filename} = $data{title} = $data{menuTitle} = $filename;
|
||||
$data{url} = $parent->getUrl.'/'.$filename;
|
||||
my $newAsset = $parent->addChild(\%data);
|
||||
$data{url} = $class->getParent->getUrl.'/'.$filename;
|
||||
my $newAsset = $class->getParent->addChild(\%data);
|
||||
$newAsset->setSize($storage->getFileSize($filename));
|
||||
$newAsset->generateThumbnail if ($class eq "WebGUI::Asset::File::Image");
|
||||
$newAsset->generateThumbnail if ($className eq "WebGUI::Asset::File::Image");
|
||||
}
|
||||
$tempStorage->delete;
|
||||
return $parent->www_manageAssets if ($session{form}{proceed} eq "manageAssets");
|
||||
return $parent->www_view;
|
||||
return $class->getParent->www_manageAssets if ($session{form}{proceed} eq "manageAssets");
|
||||
return $class->getParent->www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -176,9 +178,9 @@ sub getIcon {
|
|||
my $self = shift;
|
||||
my $small = shift;
|
||||
if ($small) {
|
||||
return $session{config}{extrasURL}.'/assets/small/folder.gif';
|
||||
return $session{config}{extrasURL}.'/assets/small/filePile.gif';
|
||||
}
|
||||
return $session{config}{extrasURL}.'/assets/folder.gif';
|
||||
return $session{config}{extrasURL}.'/assets/filePile.gif';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -200,6 +202,7 @@ sub getUploadControl {
|
|||
WebGUI::Style::setScript($session{config}{extrasURL}.'/FileUploadControl.js',{type=>"text/javascript"});
|
||||
my $uploadControl = '<div id="fileUploadControl"> </div>
|
||||
<script>
|
||||
var fileLimit = 100;
|
||||
var images = new Array();
|
||||
';
|
||||
opendir(DIR,$session{config}{extrasPath}.'/fileIcons');
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@ sub definition {
|
|||
sub DESTROY {
|
||||
my $self = shift;
|
||||
$self->{_thread}->DESTROY if (exists $self->{_thread});
|
||||
$self->{_storageLocation}->DESTROY if (exists $self->{_storageLocation});
|
||||
$self->SUPER::DESTROY;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ sub view {
|
|||
push(@{$vars{"file_loop"}},{
|
||||
id=>$child->getId,
|
||||
title=>$child->get("title"),
|
||||
synopsis=>$child->get("synopsis"),
|
||||
size=>WebGUI::Utility::formatBytes($child->get("assetSize")),
|
||||
"date.epoch"=>$child->get("dateStamp"),
|
||||
"icon.small"=>$child->getIcon(1),
|
||||
|
|
|
|||
|
|
@ -64,23 +64,23 @@ The file to generate a thumbnail for.
|
|||
|
||||
=head3 thumbnailSize
|
||||
|
||||
A size, in pixels, of the maximum height or width of a thumbnail. If specified this will change the thumbnail size of the image. If unspecified the thumbnail size set in the properties of this asset will be used.
|
||||
The size in pixels of the thumbnail to be generated. If not specified the thumbnail size in the global settings will be used.
|
||||
|
||||
=cut
|
||||
|
||||
sub generateThumbnail {
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my $thumbnailSize = shift;
|
||||
if (defined $filename) {
|
||||
my $thumbnailSize = shift || $session{setting}{thumbnailSize};
|
||||
unless (defined $filename) {
|
||||
WebGUI::ErrorHandler::warn("Can't generate a thumbnail when you haven't specified a file.");
|
||||
return 0;
|
||||
}
|
||||
if ($hasImageMagick) {
|
||||
unless ($hasImageMagick) {
|
||||
WebGUI::ErrorHandler::warn("Can't generate a thumbnail if you don't have Image Magick.");
|
||||
return 0;
|
||||
}
|
||||
if ($self->isImage($filename)) {
|
||||
unless ($self->isImage($filename)) {
|
||||
WebGUI::ErrorHandler::warn("Can't generate a thumbnail for something that's not an image.");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
BIN
www/extras/assets/filePile.gif
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.5 KiB |
BIN
www/extras/assets/small/filePile.gif
Normal file
|
After Width: | Height: | Size: 680 B |
|
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 978 B |