From 28c30cc5c163f5ff296ba5abeedb1eb05bcd2404 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 24 Aug 2007 06:41:47 +0000 Subject: [PATCH] make asset panel obey ui levels --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset.pm | 54 +++++++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 00c7b8f88..8db98597d 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -4,6 +4,7 @@ - fix: bug in EMS purge - fix: bug in poll where you can't edit it to have less answers - fix: CS post title form field sized too large + - fix: asset manager doesn't obey ui levels 7.4.3 - Data Forms set reply to to the same as the from field diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 70b0231de..99aef7ea7 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1352,6 +1352,8 @@ Main page to manage assets. Renders an AdminConsole with a list of assets. If ca sub manageAssets { my $self = shift; my $i18n = WebGUI::International->new($self->session, "Asset"); + my $userUILevel = $self->session->user->profileField("uiLevel"); + my $uiLevels = $self->session->config->get("assetToolbarUiLevel"); my $ancestors = $self->getLineage(["self","ancestors"],{returnObjects=>1}); my @crumbtrail; foreach my $ancestor (@{$ancestors}) { @@ -1359,15 +1361,22 @@ sub manageAssets { my $title = $self->getTitle; $title =~ s/\'/\\\'/g; my $more = '\n"; @@ -1392,17 +1401,22 @@ sub manageAssets { $self->session->output->print($output); $output = ''; foreach my $child (@{$self->getLineage(["children"],{returnObjects=>1})}) { - $output .= 'var contextMenu = new contextMenu_createWithLink("'.$child->getId.'","More"); - contextMenu.addLink("'.$child->getUrl("func=changeUrl;proceed=manageAssets").'","'.$i18n->get("change url").'"); - contextMenu.addLink("'.$child->getUrl("func=editBranch").'","'.$i18n->get("edit branch").'"); - contextMenu.addLink("'.$child->getUrl("func=createShortcut;proceed=manageAssets").'","'.$i18n->get("create shortcut").'"); - contextMenu.addLink("'.$child->getUrl("func=manageRevisions").'","'.$i18n->get("revisions").'"); - contextMenu.addLink("'.$child->getUrl.'","'.$i18n->get("view").'"); '."\n"; - $output .= 'contextMenu.addLink("'.$child->getUrl("func=lock;proceed=manageAssets").'","'.$i18n->get("lock").'");' unless ($child->isLocked); - if (defined $self->session->config->get("exportPath")) { - $output .= 'contextMenu.addLink("'.$child->getUrl("func=export").'","'.$i18n->get("Export","Icon").'");'; - } - my $title = $child->getTitle; + $output .= 'var contextMenu = new contextMenu_createWithLink("'.$child->getId.'","More");'; + $output .= 'contextMenu.addLink("'.$child->getUrl("func=changeUrl;proceed=manageAssets").'","'.$i18n->get("change url").'");' + if $userUILevel >= $uiLevels->{"changeUrl"}; + $output .= 'contextMenu.addLink("'.$child->getUrl("func=editBranch").'","'.$i18n->get("edit branch").'");' + if $userUILevel >= $uiLevels->{"editBranch"}; + $output .= 'contextMenu.addLink("'.$child->getUrl("func=createShortcut;proceed=manageAssets").'","'.$i18n->get("create shortcut").'");' + if $userUILevel >= $uiLevels->{"shortcut"}; + $output .= 'contextMenu.addLink("'.$child->getUrl("func=manageRevisions").'","'.$i18n->get("revisions").'");' + if $userUILevel >= $uiLevels->{"revisions"}; + $output .= 'contextMenu.addLink("'.$child->getUrl.'","'.$i18n->get("view").'"); '."\n" + if $userUILevel >= $uiLevels->{"view"}; + $output .= 'contextMenu.addLink("'.$child->getUrl("func=lock;proceed=manageAssets").'","'.$i18n->get("lock").'");' + if $userUILevel >= $uiLevels->{"changeUrl"} && !$child->isLocked; + $output .= 'contextMenu.addLink("'.$child->getUrl("func=export").'","'.$i18n->get("Export","Icon").'");' + if $userUILevel >= $uiLevels->{"export"} && defined $self->session->config->get("exportPath"); + my $title = $child->getTitle; $title =~ s/\'/\\\'/g; my $locked; my $edit;