fixed: Admin bar won't show multiple packages or prototypes with the duplicate titles
This commit is contained in:
parent
2ab07179bd
commit
a5afa49169
2 changed files with 47 additions and 33 deletions
|
|
@ -1,4 +1,5 @@
|
|||
7.7.17
|
||||
- fixed: Admin bar won't show multiple packages or prototypes with the duplicate titles
|
||||
- fixed: Only users in 'Content Managers' can create shortcuts
|
||||
- fixed #10748: In-store credit not reported correctly in email
|
||||
- fixed #10746: SQL queriy is improper for MySQL compliant query
|
||||
|
|
|
|||
|
|
@ -127,51 +127,64 @@ sub process {
|
|||
foreach my $assetClass (keys %assetList) {
|
||||
my $dummy = WebGUI::Asset->newByPropertyHashRef($session,{dummy=>1, className=>$assetClass});
|
||||
next unless defined $dummy;
|
||||
next if $dummy->getUiLevel($assetList{$assetClass}{uiLevel}) > $userUiLevel;
|
||||
next unless ($dummy->canAdd($session));
|
||||
next unless exists $categories{$assetList{$assetClass}{category}};
|
||||
$categories{$assetList{$assetClass}{category}}{items}{$dummy->getTitle} = {
|
||||
icon => $dummy->getIcon(1),
|
||||
url => $asset->getUrl("func=add;class=".$dummy->get('className').$proceed),
|
||||
};
|
||||
}
|
||||
my $assetConfig = $assetList{$assetClass};
|
||||
next if $dummy->getUiLevel( $assetConfig->{uiLevel} ) > $userUiLevel;
|
||||
next unless ($dummy->canAdd($session));
|
||||
my $assetInfo = {
|
||||
icon => $dummy->getIcon(1),
|
||||
url => $asset->getUrl("func=add;class=" . $dummy->get('className')),
|
||||
title => $dummy->getTitle,
|
||||
};
|
||||
my @assetCategories = ref $assetConfig->{category} ? @{$assetConfig->{category}} : $assetConfig->{category};
|
||||
for my $category (@assetCategories) {
|
||||
next unless exists $categories{$category};
|
||||
$categories{$category}{items} ||= [];
|
||||
push @{ $categories{$category}{items} }, $assetInfo;
|
||||
}
|
||||
}
|
||||
|
||||
# packages
|
||||
foreach my $package (@{$session->asset->getPackageList}) {
|
||||
next unless ($package->canView && $package->canAdd($session) && $package->getUiLevel <= $userUiLevel);
|
||||
$categories{packages}{items}{$package->getTitle} = {
|
||||
url => $asset->getUrl("func=deployPackage;assetId=".$package->getId.$proceed),
|
||||
icon => $package->getIcon(1),
|
||||
};
|
||||
$categories{packages}{items} ||= [];
|
||||
push @{$categories{packages}{items}}, {
|
||||
title => $package->getTitle,
|
||||
url => $asset->getUrl("func=deployPackage;assetId=".$package->getId.$proceed),
|
||||
icon => $package->getIcon(1),
|
||||
};
|
||||
}
|
||||
if ($categories{packages}{items} && @{$categories{packages}{items}}) {
|
||||
$categories{packages}{title} = $i18n->get('packages');
|
||||
$categoryTitles{$i18n->get('packages')} = "packages";
|
||||
}
|
||||
if (scalar keys %{$categories{packages}{items}}) {
|
||||
$categories{packages}{title} = $i18n->get('packages');
|
||||
$categoryTitles{$i18n->get('packages')} = "packages";
|
||||
}
|
||||
|
||||
# prototypes
|
||||
foreach my $prototype (@{ $session->asset->getPrototypeList }) {
|
||||
next unless ($prototype->canView && $prototype->canAdd($session) && $prototype->getUiLevel <= $userUiLevel);
|
||||
$categories{prototypes}{items}{$prototype->getTitle} = {
|
||||
url => $asset->getUrl("func=add;class=".$prototype->get('className').";prototype=".$prototype->getId.$proceed),
|
||||
icon => $prototype->getIcon(1),
|
||||
};
|
||||
}
|
||||
if (scalar keys %{$categories{prototypes}{items}}) {
|
||||
$categories{prototypes}{title} = $i18n->get('prototypes');
|
||||
$categoryTitles{$i18n->get('prototypes')} = "prototypes";
|
||||
}
|
||||
|
||||
next unless ($prototype->canView && $prototype->canAdd($session) && $prototype->getUiLevel <= $userUiLevel);
|
||||
$categories{prototypes}{items} ||= [];
|
||||
push @{$categories{prototypes}{items}}, {
|
||||
title => $prototype->getTitle,
|
||||
url => $asset->getUrl(
|
||||
"func=add;class=".$prototype->get('className').";prototype=".$prototype->getId.$proceed
|
||||
),
|
||||
icon => $prototype->getIcon(1),
|
||||
};
|
||||
}
|
||||
if ($categories{prototypes}{items} && @{$categories{prototypes}{items}}) {
|
||||
$categories{prototypes}{title} = $i18n->get('prototypes');
|
||||
$categoryTitles{$i18n->get('prototypes')} = "prototypes";
|
||||
}
|
||||
|
||||
# render new content menu
|
||||
$out .= q{<dt id="newContentMenu" class="a-m-t">}.$i18n->get("1083").q{</dt><dd class="a-m-d"><div class="bd">};
|
||||
foreach my $categoryTitle (sort keys %categoryTitles) {
|
||||
$out .= '<div class="ncmct">'.$categoryTitle.'</div>';
|
||||
my $items = $categories{$categoryTitles{$categoryTitle}}{items};
|
||||
next unless (ref $items eq 'HASH'); # in case the category is empty
|
||||
foreach my $title (sort keys %{$items}) {
|
||||
$out .= q{<a class="link" href="}.$items->{$title}{url}.q{">}
|
||||
.q{<img src="}.$items->{$title}{icon}.q{" style="border: 0px; vertical-align: middle;" alt="icon" /> }
|
||||
.$title.q{</a>};
|
||||
next unless (ref $items eq 'ARRAY'); # in case the category is empty
|
||||
foreach my $item (sort { $a->{title} cmp $b->{title} } @{$items}) {
|
||||
$out .= q{<a class="link" href="}.$item->{url}.q{">}
|
||||
.q{<img src="}.$item->{icon}.q{" style="border: 0px; vertical-align: middle;" alt="icon" /> }
|
||||
.$item->{title}.q{</a>};
|
||||
}
|
||||
$out .= '<br />';
|
||||
}
|
||||
|
|
@ -180,7 +193,7 @@ sub process {
|
|||
|
||||
$out .= q{</dl>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.on(window, "load", function () { document.body.style.marginLeft = "160px"; });
|
||||
YAHOO.util.Event.onDOMReady(function () { document.body.style.marginLeft = "160px"; });
|
||||
AccordionMenu.openDtById("newContentMenu");
|
||||
</script>};
|
||||
return $out;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue