make asset panel obey ui levels

This commit is contained in:
Graham Knop 2007-08-24 06:41:47 +00:00
parent 5efea40a96
commit 28c30cc5c1
2 changed files with 35 additions and 20 deletions

View file

@ -4,6 +4,7 @@
- fix: bug in EMS purge - fix: bug in EMS purge
- fix: bug in poll where you can't edit it to have less answers - fix: bug in poll where you can't edit it to have less answers
- fix: CS post title form field sized too large - fix: CS post title form field sized too large
- fix: asset manager doesn't obey ui levels
7.4.3 7.4.3
- Data Forms set reply to to the same as the from field - Data Forms set reply to to the same as the from field

View file

@ -1352,6 +1352,8 @@ Main page to manage assets. Renders an AdminConsole with a list of assets. If ca
sub manageAssets { sub manageAssets {
my $self = shift; my $self = shift;
my $i18n = WebGUI::International->new($self->session, "Asset"); 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 $ancestors = $self->getLineage(["self","ancestors"],{returnObjects=>1});
my @crumbtrail; my @crumbtrail;
foreach my $ancestor (@{$ancestors}) { foreach my $ancestor (@{$ancestors}) {
@ -1359,15 +1361,22 @@ sub manageAssets {
my $title = $self->getTitle; my $title = $self->getTitle;
$title =~ s/\'/\\\'/g; $title =~ s/\'/\\\'/g;
my $more = '<script type="text/javascript"> my $more = '<script type="text/javascript">
var ct_contextMenu = new contextMenu_createWithLink("ct_'.$self->getId.'","'.$title.'"); var ct_contextMenu = new contextMenu_createWithLink("ct_'.$self->getId.'","'.$title.'");';
ct_contextMenu.addLink("'.$self->getUrl("func=changeUrl;proceed=manageAssets").'","'.$i18n->get("change url").'"); $more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=changeUrl;proceed=manageAssets").'","'.$i18n->get("change url").'");'
ct_contextMenu.addLink("'.$self->getUrl("func=editBranch").'","'.$i18n->get("edit branch").'"); if $userUILevel >= $uiLevels->{"changeUrl"};
ct_contextMenu.addLink("'.$self->getUrl("func=createShortcut;proceed=manageAssets").'","'.$i18n->get("create shortcut").'"); $more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=editBranch").'","'.$i18n->get("edit branch").'");'
ct_contextMenu.addLink("'.$self->getUrl("func=manageRevisions").'","'.$i18n->get("revisions").'"); if $userUILevel >= $uiLevels->{"editBranch"};
ct_contextMenu.addLink("'.$self->getUrl.'","'.$i18n->get("view").'"); '."\n"; $more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=createShortcut;proceed=manageAssets").'","'.$i18n->get("create shortcut").'");'
$more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=edit;proceed=manageAssets").'","'.$i18n->get("edit").'");' unless ($self->isLocked); if $userUILevel >= $uiLevels->{"shortcut"};
$more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=lock;proceed=manageAssets").'","'.$i18n->get("lock").'");' unless ($self->isLocked); $more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=manageRevisions").'","'.$i18n->get("revisions").'");'
if (defined $self->session->config->get("exportPath")) { if $userUILevel >= $uiLevels->{"revisions"};
$more .= 'ct_contextMenu.addLink("'.$self->getUrl.'","'.$i18n->get("view").'"); '."\n"
if $userUILevel >= $uiLevels->{"view"};
$more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=edit;proceed=manageAssets").'","'.$i18n->get("edit").'");'
if $userUILevel >= $uiLevels->{"edit"} && !$self->isLocked;
$more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=lock;proceed=manageAssets").'","'.$i18n->get("lock").'");'
if $userUILevel >= $uiLevels->{"lock"} && !$self->isLocked;
if (defined $self->session->config->get("exportPath") && $userUILevel >= $uiLevels->{"export"}) {
$more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=export").'","'.$i18n->get("Export","Icon").'");'; $more .= 'ct_contextMenu.addLink("'.$self->getUrl("func=export").'","'.$i18n->get("Export","Icon").'");';
} }
$more .= "\nct_contextMenu.print();\n</script>\n"; $more .= "\nct_contextMenu.print();\n</script>\n";
@ -1392,17 +1401,22 @@ sub manageAssets {
$self->session->output->print($output); $self->session->output->print($output);
$output = ''; $output = '';
foreach my $child (@{$self->getLineage(["children"],{returnObjects=>1})}) { foreach my $child (@{$self->getLineage(["children"],{returnObjects=>1})}) {
$output .= 'var contextMenu = new contextMenu_createWithLink("'.$child->getId.'","More"); $output .= 'var contextMenu = new contextMenu_createWithLink("'.$child->getId.'","More");';
contextMenu.addLink("'.$child->getUrl("func=changeUrl;proceed=manageAssets").'","'.$i18n->get("change url").'"); $output .= 'contextMenu.addLink("'.$child->getUrl("func=changeUrl;proceed=manageAssets").'","'.$i18n->get("change url").'");'
contextMenu.addLink("'.$child->getUrl("func=editBranch").'","'.$i18n->get("edit branch").'"); if $userUILevel >= $uiLevels->{"changeUrl"};
contextMenu.addLink("'.$child->getUrl("func=createShortcut;proceed=manageAssets").'","'.$i18n->get("create shortcut").'"); $output .= 'contextMenu.addLink("'.$child->getUrl("func=editBranch").'","'.$i18n->get("edit branch").'");'
contextMenu.addLink("'.$child->getUrl("func=manageRevisions").'","'.$i18n->get("revisions").'"); if $userUILevel >= $uiLevels->{"editBranch"};
contextMenu.addLink("'.$child->getUrl.'","'.$i18n->get("view").'"); '."\n"; $output .= 'contextMenu.addLink("'.$child->getUrl("func=createShortcut;proceed=manageAssets").'","'.$i18n->get("create shortcut").'");'
$output .= 'contextMenu.addLink("'.$child->getUrl("func=lock;proceed=manageAssets").'","'.$i18n->get("lock").'");' unless ($child->isLocked); if $userUILevel >= $uiLevels->{"shortcut"};
if (defined $self->session->config->get("exportPath")) { $output .= 'contextMenu.addLink("'.$child->getUrl("func=manageRevisions").'","'.$i18n->get("revisions").'");'
$output .= 'contextMenu.addLink("'.$child->getUrl("func=export").'","'.$i18n->get("Export","Icon").'");'; if $userUILevel >= $uiLevels->{"revisions"};
} $output .= 'contextMenu.addLink("'.$child->getUrl.'","'.$i18n->get("view").'"); '."\n"
my $title = $child->getTitle; 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; $title =~ s/\'/\\\'/g;
my $locked; my $locked;
my $edit; my $edit;