diff --git a/docs/upgrades/upgrade_5.2.6-5.3.0.sql b/docs/upgrades/upgrade_5.2.6-5.3.0.sql index 47709ed15..56c54ef12 100644 --- a/docs/upgrades/upgrade_5.2.6-5.3.0.sql +++ b/docs/upgrades/upgrade_5.2.6-5.3.0.sql @@ -538,6 +538,7 @@ alter table WobjectProxy add column overrideTitle int not null default 0; alter table WobjectProxy add column overrideDescription int not null default 0; alter table WobjectProxy add column overrideTemplate int not null default 0; alter table WobjectProxy add column overrideDisplayTitle int not null default 0; +alter table WobjectProxy add column proxiedTemplateId int not null default 1; delete from international where languageId=1 and namespace='WobjectProxy' and internationalId=10; insert into international (internationalId,languageId,namespace,message,lastUpdated,context) values (10,1,'WobjectProxy','Override template?', 1053183837,'Asking the user if s/he would like to use the template specified in the wobject proxy or the original template of the original wobject.'); diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index e3f9e0ec8..29dc1abef 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -67,20 +67,35 @@ sub _generatePage { .moveTopIcon('func=moveTop&wid='.${$wobject}{wobjectId}) .moveBottomIcon('func=moveBottom&wid='.${$wobject}{wobjectId}) .cutIcon('func=cut&wid='.${$wobject}{wobjectId}) - .copyIcon('func=copy&wid='.${$wobject}{wobjectId}) - .shortcutIcon('func=createShortcut&wid='.${$wobject}{wobjectId}) - .'
'; + .copyIcon('func=copy&wid='.${$wobject}{wobjectId}); + if (${$wobject}{namespace} ne "WobjectProxy" && isIn("WobjectProxy",@{$session{config}{wobjects}})) { + $contentHash{"page.position".${$wobject}{templatePosition}} .= + shortcutIcon('func=createShortcut&wid='.${$wobject}{wobjectId}) + } + $contentHash{"page.position".${$wobject}{templatePosition}} .= '
'; } if (${$wobject}{namespace} eq "WobjectProxy") { $originalWobject = $wobject; - ($wobject) = WebGUI::SQL->quickArray("select proxiedWobjectId from WobjectProxy + my ($wobjectProxy) = WebGUI::SQL->quickHashRef("select * from WobjectProxy where wobjectId=".${$wobject}{wobjectId}); - $wobject = WebGUI::SQL->quickHashRef("select * from wobject where wobject.wobjectId=".$wobject); + $wobject = WebGUI::SQL->quickHashRef("select * from wobject where wobject.wobjectId=".$wobjectProxy->{proxiedWobjectId}); if (${$wobject}{namespace} eq "") { $wobject = $originalWobject; } else { ${$wobject}{templatePosition} = ${$originalWobject}{templatePosition}; ${$wobject}{_WobjectProxy} = ${$originalWobject}{wobjectId}; + if ($wobjectProxy->{overrideTitle}) { + ${$wobject}{title} = ${$originalWobject}{title}; + } + if ($wobjectProxy->{overrideDisplayTitle}) { + ${$wobject}{displayTitle} = ${$originalWobject}{displayTitle}; + } + if ($wobjectProxy->{overrideDescription}) { + ${$wobject}{description} = ${$originalWobject}{description}; + } + if ($wobjectProxy->{overrideTemplate}) { + ${$wobject}{templateId} = $wobjectProxy->{proxiedTemplateId}; + } } } my $sql = "select * from ".$wobject->{namespace}." where wobjectId=".$wobject->{wobjectId}; diff --git a/lib/WebGUI/Icon.pm b/lib/WebGUI/Icon.pm index d43bcd219..f33cf0704 100644 --- a/lib/WebGUI/Icon.pm +++ b/lib/WebGUI/Icon.pm @@ -430,7 +430,7 @@ sub shortcutIcon { my ($output, $pageURL); $pageURL = $_[1] || $session{page}{urlizedTitle}; $output = ''; - $output .= 'Shortcut'; + $output .= 'Shortcut'; return $output; } diff --git a/lib/WebGUI/Wobject/WobjectProxy.pm b/lib/WebGUI/Wobject/WobjectProxy.pm index 27d92a29f..fcb8d3bf7 100644 --- a/lib/WebGUI/Wobject/WobjectProxy.pm +++ b/lib/WebGUI/Wobject/WobjectProxy.pm @@ -79,9 +79,17 @@ sub uiLevel { sub www_edit { my $properties = WebGUI::HTMLForm->new; my $layout = WebGUI::HTMLForm->new; + $properties->hidden( + -name=>"proxiedNamespace", + -value=>$_[0]->get("proxiedNamespace") + ); + $properties->hidden( + -name=>"proxiedWobjectId", + -value=>$_[0]->get("proxiedWobjectId") + ); $layout->template( -name=>"proxiedTemplateId", - -value=>[$_[0]->getValue("proxiedTemplateId")], + -value=>$_[0]->getValue("proxiedTemplateId"), -namespace=>$_[0]->get("proxiedNamespace") ); $properties->yesNo( @@ -96,19 +104,19 @@ sub www_edit { ); $properties->yesNo( -name=>"overrideDescription", - -value=>$_[0]->getValue("overrideTitle"), + -value=>$_[0]->getValue("overrideDescription"), -label=>WebGUI::International::get(9,$_[0]->get("namespace")) ); $layout->yesNo( -name=>"overrideTemplate", - -value=>$_[0]->getValue("overrideTitle"), + -value=>$_[0]->getValue("overrideTemplate"), -label=>WebGUI::International::get(10,$_[0]->get("namespace")) ); - my @data = WebGUI::SQL->read("select page.urlizedTitle,wobject.title from wobject left join page on wobject.pageId=page.pageId + my @data = WebGUI::SQL->quickArray("select page.urlizedTitle,wobject.title from wobject left join page on wobject.pageId=page.pageId where wobject.wobjectId=".$_[0]->get("proxiedWobjectId")); - $properties->readonly( + $properties->readOnly( -label=>WebGUI::International::get(1,$_[0]->get("namespace")), - -value=>''.$data[1].'' + -value=>''.$data[1].' ('.$_[0]->get("proxiedWobjectId").')' ); return $_[0]->SUPER::www_edit( -properties=>$properties->printRowsOnly,