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 5516c989b..99d6d1338 100644 --- a/docs/upgrades/upgrade_6.2.11-6.3.0.pl +++ b/docs/upgrades/upgrade_6.2.11-6.3.0.pl @@ -136,7 +136,7 @@ WebGUI::SQL->write("alter table WobjectProxy add column shortcutToAssetId varcha my $sth = WebGUI::SQL->read("select proxiedWobjectId from WobjectProxy"); while (my ($wobjectId) = $sth->array) { my ($assetId) = WebGUI::SQL->quickArray("select assetId from wobject where wobjectId=".quote($wobjectId)); - WebGUI::SQL->write("update WobjectProxy set assetId=".quote($assetId)." where wobjectId=".quote($wobjectId)); + WebGUI::SQL->write("update WobjectProxy set shortcutToAssetId=".quote($assetId)." where wobjectId=".quote($wobjectId)); } $sth->finish; WebGUI::SQL->write("alter table WobjectProxy drop proxiedWobjectId"); @@ -144,7 +144,7 @@ WebGUI::SQL->write("alter table WobjectProxy change proxiedTemplateId overrideTe WebGUI::SQL->write("alter table WobjectProxy change proxyByCriteria shortcutByCriteria int not null"); WebGUI::SQL->write("alter table WobjectProxy change proxyCriteria shortcutCriteria text not null"); WebGUI::SQL->write("alter table WobjectProxy rename Shortcut"); -WebGUI::SQL->write("update asset set className='WebGUI::Asset::Shortcut' where className='WebGUI::Asset::Wobject::WobjectShortcut'"); +WebGUI::SQL->write("update asset set className='WebGUI::Asset::Shortcut' where className='WebGUI::Asset::Wobject::WobjectProxy'"); WebGUI::SQL->write("alter table wobject drop column wobjectId"); WebGUI::SQL->write("alter table wobject add primary key (assetId)"); WebGUI::SQL->write("alter table wobject drop column templateId"); @@ -595,7 +595,33 @@ while (my ($assetId, $namespace, $tid) = $sth->array) { } $sth->finish; WebGUI::SQL->write("alter table Shortcut drop column proxiedNamespace"); - +WebGUI::SQL->write("alter table Shortcut change templateId templateId varchar(22) not null"); +WebGUI::SQL->write("update Shortcut set templateId='PBtmpl0000000000000140'"); +use WebGUI::Asset; +my $import = WebGUI::Asset->getImportNode; +my $newTemplate = $import->addChild({ + className=>'WebGUI::Asset::Template', + namespace=>'Shortcut', + title=>'Default Shortcut', + menuTitle=>'Default Shortcut', + template=>' + + +

+
+
+
+
+ + + +
+
+
+
+
+ ' + },'PBtmpl0000000000000140'); @@ -924,7 +950,7 @@ sub walkTree { where pageId=".quote($namespace->{startAtThisLevel})); WebGUI::SQL->setRow("Navigation","assetId",{ assetId=>$wobjectId, - endPoint=>$namespace->{depth}, + endPoint=>$namespace->{depth}||55, startPoint=>$starturl, startType=>"specificUrl", templateId=>"1", diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 4ff4ced97..af1250863 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -154,7 +154,7 @@ Adds a child asset to a parent. Creates a new AssetID for child. Makes the paren =head3 properties -A hash reference containing a list of properties to associate with the child. The only used property value is "className" +A hash reference containing a list of properties to associate with the child. The only required property value is "className" =head3 id @@ -165,14 +165,14 @@ A unique 22 character ID. By default WebGUI will generate this and you should a sub addChild { my $self = shift; my $properties = shift; - my $id = WebGUI::Id::generate() || shift; + my $id = shift || WebGUI::Id::generate(); my $lineage = $self->get("lineage").$self->getNextChildRank; $self->{_hasChildren} = 1; WebGUI::SQL->beginTransaction; - WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, state, className, url, startDate, endDate) + WebGUI::SQL->write("insert into asset (assetId, parentId, lineage, state, className, url, startDate, endDate, ownerUserId, groupIdEdit, groupIdView) values (".quote($id).",".quote($self->getId).", ".quote($lineage).", 'published', ".quote($properties->{className}).", ".quote($id).", - 997995720, 9223372036854775807)"); + 997995720, 9223372036854775807,'3','3','7')"); my $tempAsset = WebGUI::Asset->newByDynamicClass("new",$properties->{className}); foreach my $definition (@{$tempAsset->definition}) { unless ($definition->{tableName} eq "asset") { @@ -1425,7 +1425,7 @@ sub getToolbar { .copyIcon('func=copy',$self->get("url")); # .moveTopIcon('func=moveTop&wid='.${$wobject}{wobjectId}) # .moveBottomIcon('func=moveBottom&wid='.${$wobject}{wobjectId}) - $toolbar .= shortcutIcon('func=createShortcut') unless ($self->get("className") =~ /Shortcut/); + $toolbar .= shortcutIcon('func=createShortcut',$self->get("url")) unless ($self->get("className") =~ /Shortcut/); return $toolbar; } @@ -1800,12 +1800,12 @@ sub processTemplate { %{$self->{_properties}}, %{$var} ); - if (defined $self->get("_WobjectProxy")) { - $vars{isShortcut} = 1; - my ($originalPageURL) = WebGUI::SQL->quickArray("select url from asset where assetId=".quote($self->getId),WebGUI::SQL->getSlave); - $vars{originalURL} = WebGUI::URL::gateway($originalPageURL."#".$self->getId); + my $template = WebGUI::Asset::Template->new($templateId); + if (defined $template) { + return $template->process(\%vars); + } else { + return "Error: Can't instanciate template ".$templateId; } - return WebGUI::Asset::Template->new($templateId)->process(\%vars); } #------------------------------------------------------------------- @@ -2079,8 +2079,8 @@ sub updateHistory { WebGUI::SQL->beginTransaction; WebGUI::SQL->write("insert into assetHistory (assetId, userId, actionTaken, dateStamp) values ( ".quote($self->getId).", ".quote($userId).", ".quote($action).", ".$dateStamp.")"); - $self->update({lastUpdated=>$dateStamp,lastUpdatedBy=>$userId}); WebGUI::SQL->commit; + $self->update({lastUpdated=>$dateStamp,lastUpdatedBy=>$userId}); } #------------------------------------------------------------------- @@ -2167,9 +2167,16 @@ sub www_copyList { sub www_createShortcut () { my $self = shift; - $self->addChild({ - className=>$self->get("className"), + my $child = $self->addChild({ + className=>'WebGUI::Asset::Shortcut', + shortcutToAssetId=>$self->getId, + title=>$self->get("title"), + menuTitle=>$self->get("menuTitle"), + url=>$self->get("title"), + templateId=>'PBtmpl0000000000000140' }); + $child->cut; + return $self->getContainer->www_view; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index cde282c1f..28a6f96c0 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -25,8 +25,8 @@ sub definition { my $class = shift; my $definition = shift; push(@{$definition}, { - tableName=>'FileAsset', - className=>'WebGUI::Asset::File', + tableName=>'Shortcut', + className=>'WebGUI::Asset::Shortcut', properties=>{ shortcutToAssetId=>{ fieldType=>"hidden", @@ -63,6 +63,10 @@ sub definition { shortcutCriteria=>{ fieldType=>"textarea", defaultValue=>"", + }, + templateId=>{ + fieldType=>"template", + defaultValue=>"PBtmpl0000000000000140" } } }); @@ -75,7 +79,11 @@ sub definition { sub getEditForm { my $self = shift; my $tabform = $self->SUPER::getEditForm(); - my $originalTemplate = WebGUI::Asset::Template->new(self->getShortcut->get("templateId")); + my $originalTemplate = WebGUI::Asset::Template->new($self->getShortcut->get("templateId")); + $tabform->getTab("display")->template( + -value=>$self->getValue("templateId"), + -namespace=>"Shortcut" + ); $tabform->getTab("display")->template( -name=>"overrideTemplateId", -value=>$self->getValue("overrideTemplateId") || $originalTemplate->getId, @@ -145,8 +153,8 @@ sub getEditForm { sub getIcon { my $self = shift; my $small = shift; - return $session{config}{extrasURL}.'/assets/small/template.gif' if ($small); - return $session{config}{extrasURL}.'/assets/template.gif'; + return $session{config}{extrasURL}.'/assets/small/shortcut.gif' if ($small); + return $session{config}{extrasURL}.'/assets/shortcut.gif'; } #------------------------------------------------------------------- @@ -312,7 +320,13 @@ sub processPropertiesFromFormPost { #------------------------------------------------------------------- sub view { my $self = shift; - return $self->getShortcut->view; + my %var = ( + isShortcut => 1, + 'shortcut.content' => $self->getShortcut->view, + 'shortcut.label' => 'Shortcut', + originalURL => $self->getShortcut->getUrl + ); + return $self->processTemplate(\%var,$self->getValue("templateId")); } diff --git a/lib/WebGUI/Asset/Wobject.pm b/lib/WebGUI/Asset/Wobject.pm index b0a89e98a..50921eebe 100644 --- a/lib/WebGUI/Asset/Wobject.pm +++ b/lib/WebGUI/Asset/Wobject.pm @@ -28,7 +28,6 @@ use WebGUI::Session; use WebGUI::Style; use WebGUI::SQL; use WebGUI::Utility; -#use WebGUI::Asset::Wobject::WobjectProxy; our @ISA = qw(WebGUI::Asset); @@ -558,33 +557,6 @@ sub setCollateral { -#------------------------------------------------------------------- - -=head2 www_createShortcut ( ) - -Creates a shortcut (using the wobject proxy) of this wobject on the clipboard. - -B Should never need to be overridden or extended. - -=cut - -sub www_createShortcut { - my $self = shift; - return WebGUI::Privilege::insufficient() unless ($self->canEdit); - my $w = WebGUI::Wobject::WobjectProxy->new({wobjectId=>"new",namespace=>"WobjectProxy"}); - $w->update({ - pageId=>'2', - templatePosition=>1, - title=>$self->getValue("title"), - proxiedNamespace=>$self->get("namespace"), - proxiedWobjectId=>$self->get("wobjectId"), - bufferUserId=>$session{user}{userId}, - bufferDate=>WebGUI::DateTime::time(), - bufferPrevId=>$session{page}{pageId} - }); - return ""; -} - diff --git a/lib/WebGUI/i18n/English/Navigation.pm b/lib/WebGUI/i18n/English/Navigation.pm index 5a2e20e78..9275320c5 100644 --- a/lib/WebGUI/i18n/English/Navigation.pm +++ b/lib/WebGUI/i18n/English/Navigation.pm @@ -27,6 +27,11 @@ our $I18N = { context => q|Title of the navigation manager in the admin console.| }, + '22' => { + message => q|Edit Navigation|, + lastUpdated => 1078208044 + }, + '1098' => { message => q|Navigation, Add/Edit|, lastUpdated => 1078208044