rfe: add all asset properties to the Navigation Asset

This commit is contained in:
Colin Kuskie 2008-09-16 20:25:08 +00:00
parent 2927c30f63
commit 2afadf1cf7
3 changed files with 21 additions and 19 deletions

View file

@ -59,6 +59,7 @@
- rfe: cancel button (for edit profile screen) - rfe: cancel button (for edit profile screen)
- rfe: Move hardcoded words to i18n - rfe: Move hardcoded words to i18n
- rfe: Better info for Assets that require commit before adding children. Add link is always availble now. If the asset has not yet been committed an error is displayed. - rfe: Better info for Assets that require commit before adding children. Add link is always availble now. If the asset has not yet been committed an error is displayed.
- rfe: Add template variables for every property of all assets referenced in the Navigation.
7.5.22 7.5.22
- fixed: Layout template now gets prepared correctly - fixed: Layout template now gets prepared correctly

View file

@ -324,7 +324,7 @@ sub getToolbar {
. '<div class="bd">' . '<div class="bd">'
. '<ul class="first-of-type">' . '<ul class="first-of-type">'
. '<li class="yuimenuitem"><a class="yuimenuitemlabel" href="' . '<li class="yuimenuitem"><a class="yuimenuitemlabel" href="'
. $self->getUrl("func=copy") . '">' . $i18n->get("copy") . '</a></li>' . $self->getUrl("func=copy") . '">' . $i18n->get("Copy") . '</a></li>'
. '<li class="yuimenuitem"><a class="yuimenuitemlabel" href="' . '<li class="yuimenuitem"><a class="yuimenuitemlabel" href="'
. $self->getUrl("op=assetManager") . '">' . $i18n->get("manage") . '</a></li>' . $self->getUrl("op=assetManager") . '">' . $i18n->get("manage") . '</a></li>'
. '<li class="yuimenuitem"><a class="yuimenuitemlabel" href="' . '<li class="yuimenuitem"><a class="yuimenuitemlabel" href="'
@ -387,12 +387,11 @@ sub view {
my $assets = $start->getLineage(\@includedRelationships,\%rules); my $assets = $start->getLineage(\@includedRelationships,\%rules);
my $var = {'page_loop' => []}; my $var = {'page_loop' => []};
my @interestingProperties = ('assetId', 'parentId', 'ownerUserId', 'synopsis', 'newWindow'); while (my ($property, $propertyValue) = each %{ $current->get() }) {
foreach my $property (@interestingProperties) { $var->{'currentPage.'.$property} = $propertyValue;
$var->{'currentPage.'.$property} = $current->get($property);
} }
$var->{'currentPage.menuTitle'} = $current->getMenuTitle; $var->{'currentPage.menuTitle'} = $current->getMenuTitle;
$var->{'currentPage.title'} = $current->getTitle; $var->{'currentPage.title'} = $current->getTitle;
$var->{'currentPage.isHome'} = ($current->getId eq $self->session->setting->get("defaultPage")); $var->{'currentPage.isHome'} = ($current->getId eq $self->session->setting->get("defaultPage"));
$var->{'currentPage.url'} = $current->getUrl; $var->{'currentPage.url'} = $current->getUrl;
$var->{'currentPage.hasChild'} = $current->hasChildren; $var->{'currentPage.hasChild'} = $current->hasChildren;
@ -428,13 +427,13 @@ sub view {
next; next;
} }
my $pageData = {}; my $pageData = {};
foreach my $property (@interestingProperties) { while (my ($property, $propertyValue) = each %{ $asset->get() }) {
$pageData->{"page.".$property} = $asset->get($property); $pageData->{"page.".$property} = $propertyValue;
} }
$pageData->{'page.menuTitle'} = $asset->getMenuTitle; $pageData->{'page.menuTitle'} = $asset->getMenuTitle;
$pageData->{'page.title'} = $asset->getTitle; $pageData->{'page.title'} = $asset->getTitle;
# build nav variables # build nav variables
$pageData->{"page.rank"} = $asset->getRank; $pageData->{"page.rank"} = $asset->getRank;
$pageData->{"page.absDepth"} = $asset->getLineageLength; $pageData->{"page.absDepth"} = $asset->getLineageLength;
$pageData->{"page.relDepth"} = $asset->getLineageLength - $start->getLineageLength; $pageData->{"page.relDepth"} = $asset->getLineageLength - $start->getLineageLength;
$pageData->{"page.isSystem"} = $asset->get("isSystem"); $pageData->{"page.isSystem"} = $asset->get("isSystem");
@ -485,14 +484,14 @@ sub view {
my $parent = $asset->getParent; my $parent = $asset->getParent;
if (defined $parent) { if (defined $parent) {
foreach my $property (@interestingProperties) { while (my ($property, $propertyValue) = each %{ $parent->get() }) {
$pageData->{"page.parent.".$property} = $parent->get($property); $pageData->{"page.parent.".$property} = $propertyValue;
} }
$pageData->{'page.parent.menuTitle'} = $parent->getMenuTitle; $pageData->{'page.parent.menuTitle'} = $parent->getMenuTitle;
$pageData->{'page.parent.title'} = $parent->getTitle; $pageData->{'page.parent.title'} = $parent->getTitle;
$pageData->{"page.parent.url"} = $parent->getUrl; $pageData->{"page.parent.url"} = $parent->getUrl;
$pageData->{"page.parent.rank"} = $parent->getRank; $pageData->{"page.parent.rank"} = $parent->getRank;
$pageData->{"page.isRankedFirst"} = 1 unless exists $lastChildren{$parent->getId}; $pageData->{"page.isRankedFirst"} = 1 unless exists $lastChildren{$parent->getId};
$lastChildren{$parent->getId} = $asset->getId; $lastChildren{$parent->getId} = $asset->getId;
} }
$previousPageData->{"page.hasViewableChildren"} = ($previousPageData->{"page.assetId"} eq $pageData->{"page.parentId"}); $previousPageData->{"page.hasViewableChildren"} = ($previousPageData->{"page.assetId"} eq $pageData->{"page.parentId"});

View file

@ -273,8 +273,8 @@ the Navigation Template to determine who can see them in the menu.</p>
}, },
'page_loop' => { 'page_loop' => {
message => q|A loop containing pages in nested, hierarchical order.|, message => q|A loop containing pages in nested, hierarchical order. Every property of each page is available. A handfull of them are listed below. Please consult the template variables for each Asset type for a full list.|,
lastUpdated => 1149394665, lastUpdated => 1221594907,
}, },
'page.assetId' => { 'page.assetId' => {
@ -528,9 +528,11 @@ the Navigation Template to determine who can see them in the menu.</p>
'1097' => { '1097' => {
message => q|<p>These variables are available in Navigation Templates:</p> message => q|<p>These variables are available in Navigation Templates:</p>
<p><b>currentPage</b> refers to the page that the user is currently looking at. <b>page</b> refers to any <p><b>currentPage</b> refers to the page that the user is currently looking at. <b>page</b> refers to any
given page inside of the <b>page_loop</b></p> given page inside of the <b>page_loop</b></p>.
<p>When referring to a page, or a child, or a parent, every Asset property is available. Only the most useful
ones are listed below.</p>
|, |,
lastUpdated => 1163720438, lastUpdated => 1221595018,
}, },
'mimeType' => { 'mimeType' => {