made it so it's possible to use file form elements without any auxillary code

fixed a bug in Post
storage copy can accept an optional new storage location to copy to
articles can now accept direct attachments
This commit is contained in:
JT Smith 2006-04-16 17:30:01 +00:00
parent c523f9c09d
commit 4adfc0737c
13 changed files with 131 additions and 35 deletions

View file

@ -27,8 +27,7 @@
<a href="<tmpl_var linkUrl>"><tmpl_var linkTitle></a>
</tmpl_if>
</tmpl_if>
<tmpl_var attachment.icon> <tmpl_var attachment.name> <tmpl_var attachment.name>
<p />
<tmpl_if attachment.name><p><p style="display:inline;vertical-align:middle;"><a href="<tmpl_var attachment.url>"><img src="<tmpl_var attachment.icon>" style="vertical-align:middle;border: 0px;" alt="<tmpl_var attachment.name>" /> <tmpl_var attachment.name></a></p></p></tmpl_if>
</tmpl_if>
<tmpl_if pagination.pageCount.isMultiple>

View file

@ -27,7 +27,7 @@
<a href="<tmpl_var linkUrl>"><tmpl_var linkTitle></a>
</tmpl_if>
</tmpl_if>
<tmpl_var attachment.icon> <tmpl_var attachment.name> <tmpl_var attachment.name>
<tmpl_if attachment.name><p><p style="display:inline;vertical-align:middle;"><a href="<tmpl_var attachment.url>"><img src="<tmpl_var attachment.icon>" style="vertical-align:middle;border: 0px;" alt="<tmpl_var attachment.name>" /> <tmpl_var attachment.name></a></p></p></tmpl_if>
</tmpl_if>
<tmpl_if pagination.pageCount.isMultiple>

View file

@ -6,18 +6,12 @@
</tmpl_if>
<tmpl_if displaytitle>
<tmpl_if linkurl>
<a href="<tmpl_var linkurl>">
</tmpl_if>
<span class="itemTitle"><tmpl_var title></span>
<tmpl_if linkurl>
</a>
</tmpl_if>
<tmpl_if linkurl><a href="<tmpl_var linkurl>"></tmpl_if><span class="itemTitle"><tmpl_var title></span><tmpl_if linkurl></a></tmpl_if>
</tmpl_if>
<tmpl_if attachment.name>
<tmpl_if displaytitle> - </tmpl_if>
<a href="<tmpl_var attachment.url>"><img src="<tmpl_var attachment.Icon>" alt="<tmpl_var attachment.name>" width="16" height="16" border="0" align="middle" /></a>
<p style="display:inline;vertical-align:middle;"><a href="<tmpl_var attachment.url>"><img src="<tmpl_var attachment.icon>" style="vertical-align:middle;border: 0px;" alt="<tmpl_var attachment.name>" /></a></p>
</tmpl_if>
<tmpl_if description>

View file

@ -6,18 +6,12 @@
</tmpl_if>
<tmpl_if displaytitle>
<tmpl_if linkurl>
<a href="<tmpl_var linkurl>" target="_blank">
</tmpl_if>
<span class="itemTitle"><tmpl_var title></span>
<tmpl_if linkurl>
</a>
</tmpl_if>
<tmpl_if linkurl><a href="#" onclick="window.open('<tmpl_var linkurl>');"></tmpl_if><span class="itemTitle"><tmpl_var title></span><tmpl_if linkurl></a></tmpl_if>
</tmpl_if>
<tmpl_if attachment.name>
<tmpl_if displaytitle> - </tmpl_if>
<a href="<tmpl_var attachment.url>" target="_blank"><img src="<tmpl_var attachment.Icon>" alt="<tmpl_var attachment.name>" width="16" height="16" border="0" align="middle" /></a>
<p style="display:inline;vertical-align:middle;"><a href="<tmpl_var attachment.url>"><img src="<tmpl_var attachment.icon>" style="vertical-align:middle;border: 0px;" alt="<tmpl_var attachment.name>" /></a></p>
</tmpl_if>
<tmpl_if description>

View file

@ -29,7 +29,7 @@
</tmpl_if>
</tmpl_if>
<tmpl_var attachment.icon> <tmpl_var attachment.name> <tmpl_var attachment.name> <p />
<tmpl_if attachment.name><p><p style="display:inline;vertical-align:middle;"><a href="<tmpl_var attachment.url>"><img src="<tmpl_var attachment.icon>" style="vertical-align:middle;border: 0px;" alt="<tmpl_var attachment.name>" /> <tmpl_var attachment.name></a></p></p></tmpl_if>
</tmpl_if>
<tmpl_if pagination.isFirstPage>

View file

@ -32,8 +32,7 @@
</tmpl_if>
<tmpl_if pagination.isLastPage>
<tmpl_var attachment.icon> <tmpl_var attachment.name> <tmpl_var attachment.name>
<p />
<tmpl_if attachment.name><p><p style="display:inline;vertical-align:middle;"><a href="<tmpl_var attachment.url>"><img src="<tmpl_var attachment.icon>" style="vertical-align:middle;border: 0px;" alt="<tmpl_var attachment.name>" /> <tmpl_var attachment.name></a></p></p></tmpl_if>
</tmpl_if>
<tmpl_if pagination.isFirstPage>

View file

@ -17,6 +17,7 @@ use File::Path;
use WebGUI::Workflow;
use WebGUI::Workflow::Cron;
use WebGUI::Group;
use WebGUI::Storage;
my $toVersion = "6.99.0"; # make this match what version you're going to
my $quiet; # this line required
@ -54,6 +55,25 @@ finish($session); # this line required
sub updateArticle {
print "\tAllowing articles to have direct attachments.\n";
$session->db->write("alter table Article add column storageId varchar(22) binary");
my $rs = $session->db->read("select assetId from asset where className='WebGUI::Asset::Wobject::Article'");
while (my ($id) = $rs->array) {
my $asset = WebGUI::Asset->new($id, "WebGUI::Asset::Wobject::Article");
if (defined $asset) {
my $children = $asset->getLineage(["children"],{returnObjects=>1, includeOnlyClasses=>["WebGUI::Asset::File","WebGUI::Asset::File::Image"]});
if (scalar(@{$children})) {
my $storage = undef;
if ($asset->get("storageId")) {
$storage = WebGUI::Storage->get($session,$asset->get("storageId"));
} else {
$storage = WebGUI::Storage->create($session);
$asset->update({storageId=>$storage->getId});
}
foreach my $child (@{$children}) {
$child->getStorageLocation->copy($storage);
}
}
}
}
}
#-------------------------------------------------