From d0ac36daf32ee84fbaab4ac8f72a5d35205c4be5 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sat, 5 Feb 2005 22:58:37 +0000 Subject: [PATCH] fixed a feedback loop with shortcut --- docs/upgrades/upgrade_6.2.11-6.3.0.pl | 4 +--- lib/WebGUI/Asset.pm | 7 +++++++ lib/WebGUI/Asset/Shortcut.pm | 10 ++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/upgrades/upgrade_6.2.11-6.3.0.pl b/docs/upgrades/upgrade_6.2.11-6.3.0.pl index 99d6d1338..abef2cf96 100644 --- a/docs/upgrades/upgrade_6.2.11-6.3.0.pl +++ b/docs/upgrades/upgrade_6.2.11-6.3.0.pl @@ -119,8 +119,7 @@ walkTree('0','PBasset000000000000001','000001','2'); mapProductCollateral(); print "\t\tMaking second round of table structure changes\n" unless ($quiet); -my $sth = WebGUI::SQL->read("select distinct(namespace) from wobject where namespace is not null"); -while (my ($namespace) = $sth->array) { +foreach my $namespace (@allWobjects) { if (isIn($namespace, @wobjects)) { WebGUI::SQL->write("alter table ".$namespace." drop column wobjectId"); WebGUI::SQL->write("alter table ".$namespace." add primary key (assetId)"); @@ -131,7 +130,6 @@ while (my ($namespace) = $sth->array) { WebGUI::SQL->write("alter table ".$namespace." add primary key (assetId)"); } } -$sth->finish; WebGUI::SQL->write("alter table WobjectProxy add column shortcutToAssetId varchar(22) not null"); my $sth = WebGUI::SQL->read("select proxiedWobjectId from WobjectProxy"); while (my ($wobjectId) = $sth->array) { diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index af1250863..bcfdfa5ce 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -2172,6 +2172,13 @@ sub www_createShortcut () { shortcutToAssetId=>$self->getId, title=>$self->get("title"), menuTitle=>$self->get("menuTitle"), + isHidden=>$self->get("isHidden"), + newWindow=>$self->get("newWindow"), + startDate=>$self->get("startDate"), + endDate=>$self->get("endDate"), + ownerUserId=>$self->get("ownerUserId"), + groupIdEdit=>$self->get("groupIdEdit"), + groupIdView=>$self->get("groupIdView"), url=>$self->get("title"), templateId=>'PBtmpl0000000000000140' }); diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index 28a6f96c0..7ff36a59c 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -320,9 +320,15 @@ sub processPropertiesFromFormPost { #------------------------------------------------------------------- sub view { my $self = shift; + my $content; + if ($self->get("shortcutToAssetId") eq $self->get("parentId")) { + $content = "Displaying this shortcut would cause a feedback loop."; + } else { + $content = $self->getShortcut->view; + } my %var = ( isShortcut => 1, - 'shortcut.content' => $self->getShortcut->view, + 'shortcut.content' => $content, 'shortcut.label' => 'Shortcut', originalURL => $self->getShortcut->getUrl ); @@ -335,7 +341,7 @@ sub www_edit { my $self = shift; return WebGUI::Privilege::insufficient() unless $self->canEdit; $self->getAdminConsole->setHelp("shortcut add/edit","Shortcut"); - return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get(2)); + return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get(2,"Shortcut")); } #-------------------------------------------------------------------