more versioning bug fixes

This commit is contained in:
JT Smith 2005-08-11 21:36:55 +00:00
parent 7fae1e435d
commit beca69b465
5 changed files with 29 additions and 60 deletions

View file

@ -161,6 +161,10 @@ to add addRevision(), purge(), and purgeRevision() methods to your asset. See
WebGUI::Asset::File and WebGUI::Asset:Post for examples of what these methods
should look like.
Also, if you have written any queries to go against the "asset" table, you
should note that the asset table has been split into two tables "asset" and
"assetData". So you'll need to change your queries appropriately.
Other than that you shouldn't have to make any revisions to your asset to
support versioning. Your collateral tables need not have the revision date as
they'll be tied to the assetId regardless of the revision date.

View file

@ -26,7 +26,6 @@ use WebGUI::Operation;
use WebGUI::Paginator;
use WebGUI::Privilege;
use WebGUI::Session;
use WebGUI::SQL;
use WebGUI::Style;
use WebGUI::Asset::Template;
use WebGUI::URL;
@ -406,29 +405,6 @@ sub view {
$var{"edit.label"} = WebGUI::International::get(575,"Asset_Event");
$var{"delete.url"} = WebGUI::URL::page('func=deleteEvent&rid='.$self->getValue("EventsCalendar_recurringId"));
$var{"delete.label"} = WebGUI::International::get(576,"Asset_Event");
# my $query = "select EventsCalendar_eventId from EventsCalendar_event where EventsCalendar_eventId<>".quote($event->getValue("EventsCalendar_eventId});
# $query .= " and wobjectId=".quote($self->get("wobjectId")) unless ($self->get("isMaster"));
# $query .= " and startDate<=$event->getValue("startDate} order by startDate desc, endDate desc";
# ($id) = WebGUI::SQL->quickArray($query,WebGUI::SQL->getSlave);
# $var{"previous.label"} = '&laquo;'.WebGUI::International::get(92,"Asset_Event");
# $var{"previous.url"} = WebGUI::URL::page("func=viewEvent&wid=".$self->get("wobjectId")."&eid=".$id) if ($id);
# $query = "select EventsCalendar_eventId from EventsCalendar_event where EventsCalendar_eventId<>".quote($event->getValue("EventsCalendar_eventId});
# $query .= " and wobjectId=".quote($self->get("wobjectId")) unless ($self->get("isMaster"));
# $query .= " and startDate>=$event->getValue("eventStartDate") order by startDate, endDate";
# ($id) = WebGUI::SQL->quickArray($query,WebGUI::SQL->getSlave);
# $var{"next.label"} = WebGUI::International::get(93,"Asset_Event").'&raquo;';
# $var{"next.url"} = WebGUI::URL::page("func=viewEvent&wid=".$self->get("wobjectId")."&eid=".$id) if ($id);
$var{description} = $event->getValue("description");
# my $where = "eventscalendar.type=2";
# my $kiddos = $self->getLineage(["children"],{returnObjects=>1,joinClass=>"WebGUI::Asset::Wobject::EventsCalendar",whereClause=>$where});
# my $tabform = WebGUI::TabForm->new();
# #let's try to create a template variable that is a tabform of agendas.
# foreach my $agenda (@{$kiddos}) {
# $tabform->addTab($agenda->getId,$agenda->getValue("title"));
# #These will be in order of lineage. Use the Asset Manager to change the order.
# $tabform->getTab($agenda->getId)->raw($agenda->WebGUI::Asset::Wobject::EventsCalendar::view);
# }
# $var{agendas} = $tabform->print;
my $vars = \%var;
#get parent so we can get the parent's style. Hopefully the parent is an EventsCalendar. If not, oh well.
my $parent = $self->getParent;

View file

@ -215,20 +215,6 @@ sub getShortcut {
This function will search for a asset that match a metadata criteria set.
If no asset is found, undef will be returned.
=head3 hashRef
A typical hashRef for this function will look like:
{
proxiedNamespace => "Article",
resolveMultiples => "random",
shortcutCriteria => 'State = "Wisconsin" AND County != "Sauk"'
}
Most of the time this will be a:
WebGUI::SQL->quickHashRef("select * from AssetProxy where assetId=".quote($proxiedId));
=cut
sub getShortcutByCriteria {

View file

@ -335,7 +335,7 @@ sub www_addAccessory {
);
@usedAccessories = WebGUI::SQL->buildArray("select accessoryAssetId from Product_accessory where assetId=".quote($self->getId));
push(@usedAccessories,$self->getId);
$accessory = WebGUI::SQL->buildHashRef("select assetId, title from asset where className='WebGUI::Asset::Wobject::Product' and assetId not in (".quoteAndJoin(\@usedAccessories).")");
$accessory = WebGUI::SQL->buildHashRef("select asset.assetId, assetData.title from asset left join assetData on assetData.assetId=asset.assetId where asset.className='WebGUI::Asset::Wobject::Product' and asset.assetId not in (".quoteAndJoin(\@usedAccessories).") and (assetData.status='approved' or assetData.tagId=".quote($session{scratch}{versionTag}).") group by assetData.assetId");
$f->selectList(
-name => "accessoryAccessId",
-options => $accessory,
@ -436,7 +436,7 @@ sub www_deleteFileConfirm {
my $store = $self->get($column);
my $file = WebGUI::Storage->get($store);
$file->delete;
WebGUI::SQL->write("update Product set $column=NULL where assetId=".quote($self->getId()));
$self->update({$column => ''});
return $self->www_edit;
}
@ -723,7 +723,12 @@ sub view {
$self->logView() if ($session{setting}{passiveProfilingEnabled});
my (%data, $sth, $file, $segment, %var, @featureloop, @benefitloop, @specificationloop, @accessoryloop, @relatedloop);
tie %data, 'Tie::CPHash';
my ($image1, $image2, $image3, $brochure, $manual, $warranty) = WebGUI::SQL->quickArray("select image1, image2, image3, brochure, manual, warranty from Product where assetId=".quote($self->getId));
my $brochure = $self->get("brochure");
my $manual = $self->get("manual");
my $warranty = $self->get("warranty");
my $image1 = $self->get("image1");
my $image2 = $self->get("image2");
my $image3 = $self->get("image3");
#---brochure
if ($brochure) {
$file = WebGUI::Storage->get($brochure);
@ -820,18 +825,17 @@ sub view {
#---accessories
$var{"addaccessory.url"} = $self->getUrl('func=addAccessory');
$var{"addaccessory.label"} = WebGUI::International::get(36,'Asset_Product');
$sth = WebGUI::SQL->read("select asset.title, asset.url, Product_accessory.accessoryAssetId
from Product_accessory,asset
$sth = WebGUI::SQL->read("select Product_accessory.accessoryAssetId from Product_accessory
where Product_accessory.assetId=".quote($self->getId)."
and Product_accessory.accessoryAssetId=asset.assetId
order by Product_accessory.sequenceNumber");
while (%data = $sth->hash) {
$segment = deleteIcon('func=deleteAccessoryConfirm&aid='.$data{accessoryAssetId},$self->get("url"),WebGUI::International::get(2,'Asset_Product'))
.moveUpIcon('func=moveAccessoryUp&aid='.$data{accessoryAssetId},$self->get("url"))
.moveDownIcon('func=moveAccessoryDown&aid='.$data{accessoryAssetId},$self->get("url"));
while (my ($id) = $sth->array) {
$segment = deleteIcon('func=deleteAccessoryConfirm&aid='.$id,$self->get("url"),WebGUI::International::get(2,'Asset_Product'))
.moveUpIcon('func=moveAccessoryUp&aid='.$id,$self->get("url"))
.moveDownIcon('func=moveAccessoryDown&aid='.$id,$self->get("url"));
my $accessory = WebGUI::Asset->newByDynamicClass($id);
push(@accessoryloop,{
"accessory.URL"=>WebGUI::URL::gateway($data{url}),
"accessory.title"=>$data{title},
"accessory.URL"=>$accessory->getUrl,
"accessory.title"=>$accessory->getTitle,
"accessory.controls"=>$segment
});
}
@ -841,18 +845,18 @@ sub view {
#---related
$var{"addrelatedproduct.url"} = $self->getUrl('func=addRelated');
$var{"addrelatedproduct.label"} = WebGUI::International::get(37,'Asset_Product');
$sth = WebGUI::SQL->read("select asset.title,asset.url,Product_related.relatedAssetId
from Product_related,asset
$sth = WebGUI::SQL->read("select Product_related.relatedAssetId
from Product_related
where Product_related.assetId=".quote($self->getId)."
and Product_related.relatedAssetId=asset.assetId
order by Product_related.sequenceNumber");
while (%data = $sth->hash) {
$segment = deleteIcon('func=deleteRelatedConfirm&rid='.$data{relatedAssetId},$self->get("url"),WebGUI::International::get(4,'Asset_Product'))
.moveUpIcon('func=moveRelatedUp&rid='.$data{relatedAssetId},$self->get("url"))
.moveDownIcon('func=moveRelatedDown&rid='.$data{relatedAssetId},$self->get("url"));
while (my ($id) = $sth->array) {
$segment = deleteIcon('func=deleteRelatedConfirm&rid='.$id,$self->get("url"),WebGUI::International::get(4,'Asset_Product'))
.moveUpIcon('func=moveRelatedUp&rid='.$id,$self->get("url"))
.moveDownIcon('func=moveRelatedDown&rid='.$id,$self->get("url"));
my $related = WebGUI::Asset->newByDynamicClass($id);
push(@relatedloop,{
"relatedproduct.URL"=>WebGUI::URL::gateway($data{url}),
"relatedproduct.title"=>$data{title},
"relatedproduct.URL"=>$related->getUrl,
"relatedproduct.title"=>$related->getTitle,
"relatedproduct.controls"=>$segment
});
}

View file

@ -1348,7 +1348,6 @@ sub www_viewStatisticalOverview {
$p->appendTemplateVars($var);
return $self->processTemplate($var, $self->getValue("overviewTemplateId"));
# return $self->processTemplate($self->getValue("overviewTemplateId"),$var,"Survey/Overview");
}
1;