Add edit and delete icons to the Story Topic. Update tests. Adjust both
sets of templates. Use the correct privileges for displaying the icons. Help and i18n.
This commit is contained in:
parent
6844ef4559
commit
8f09dc062d
9 changed files with 58 additions and 12 deletions
|
|
@ -6,7 +6,7 @@
|
|||
- fixed #10361: Shortcuts duplicate extra header tags
|
||||
- fixed #10356: SQL report is cached too long
|
||||
- fixed #10313: extra head elements appear twice
|
||||
- fixed missing edit story and delete story icons in the Story Manager.
|
||||
- fixed missing edit story and delete story icons in the Story Archive and Story Topic.
|
||||
|
||||
7.7.8
|
||||
- fixed: Basic Auth doesn't work if password contains colon (Arjan Widlak,
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -553,10 +553,10 @@ sub viewTemplateVariables {
|
|||
title => $story->getTitle,
|
||||
creationDate => $creationDate,
|
||||
};
|
||||
if ($userUiLevel >= $uiLevels->{delete}) {
|
||||
if ($story->canEdit && $userUiLevel >= $uiLevels->{delete} && !$exporting) {
|
||||
$storyVars->{deleteIcon} = $icon->delete('func=delete', $story->get('url'), $i18n->get(43));
|
||||
}
|
||||
if ($userUiLevel >= $uiLevels->{edit}) {
|
||||
if ($story->canEdit && $userUiLevel >= $uiLevels->{edit} && !$exporting) {
|
||||
$storyVars->{editIcon} = $icon->edit('func=edit', $story->get('url'));
|
||||
}
|
||||
push @{$datePointer->{story_loop}}, $storyVars;
|
||||
|
|
|
|||
|
|
@ -174,17 +174,30 @@ sub viewTemplateVariables {
|
|||
});
|
||||
my $storyIds = $p->getPageData();
|
||||
$var->{story_loop} = [];
|
||||
|
||||
my $icon = $session->icon;
|
||||
my $userUiLevel = $session->user->profileField("uiLevel");
|
||||
my $uiLevels = $session->config->get('assetToolbarUiLevel');
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
|
||||
##Only build objects for the assets that we need
|
||||
STORY: foreach my $storyId (@{ $storyIds }) {
|
||||
my $story = WebGUI::Asset->new($session, $storyId->{assetId}, $storyId->{className}, $storyId->{revisionDate});
|
||||
next STORY unless $story;
|
||||
push @{$var->{story_loop}}, {
|
||||
my $storyVars = {
|
||||
url => ( $exporting
|
||||
? $story->getUrl
|
||||
: $session->url->append($self->getUrl, 'func=viewStory;assetId='.$storyId->{assetId}) ),
|
||||
title => $story->getTitle,
|
||||
creationDate => $story->get('creationDate'),
|
||||
};
|
||||
if ($story->canEdit && $userUiLevel >= $uiLevels->{delete} && !$exporting) {
|
||||
$storyVars->{deleteIcon} = $icon->delete('func=delete', $story->get('url'), $i18n->get(43));
|
||||
}
|
||||
if ($story->canEdit && $userUiLevel >= $uiLevels->{edit} && !$exporting) {
|
||||
$storyVars->{editIcon} = $icon->edit('func=edit', $story->get('url'));
|
||||
}
|
||||
push @{$var->{story_loop}}, $storyVars;
|
||||
}
|
||||
|
||||
if ($self->{_standAlone}) {
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ our $HELP = {
|
|||
{ 'name' => 'epochDate' },
|
||||
{ 'name' => 'story_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'url' },
|
||||
{ 'name' => 'title' },
|
||||
{ 'name' => 'creationDate' },
|
||||
{ 'name' => 'deleteIcon' },
|
||||
{ 'name' => 'editIcon' },
|
||||
{ name => 'url' },
|
||||
{ name => 'title' },
|
||||
{ name => 'creationDate' },
|
||||
{ name => 'deleteIcon' },
|
||||
{ name => 'editIcon' },
|
||||
],
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ our $HELP = {
|
|||
{ name => 'url' },
|
||||
{ name => 'title' },
|
||||
{ name => 'creationDate' },
|
||||
{ name => 'deleteIcon' },
|
||||
{ name => 'editIcon' },
|
||||
],
|
||||
},
|
||||
{ name => 'topStoryTitle' },
|
||||
|
|
|
|||
|
|
@ -214,13 +214,13 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'deleteIcon' => {
|
||||
message => q|An icon to delete this story.|,
|
||||
message => q|An icon to delete this story. If the user is not allowed to delete the icon, or their UI level is set too low, this variable will be empty.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'editIcon' => {
|
||||
message => q|An icon to edit this story.|,
|
||||
message => q|An icon to edit this story. If the user is not allowed to edit the icon, or their UI level is set too low, this variable will be empty.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -81,6 +81,18 @@ our $I18N = {
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'deleteIcon' => {
|
||||
message => q|An icon to delete this story. If the user is not allowed to delete the icon, or their UI level is set too low, this variable will be empty.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'editIcon' => {
|
||||
message => q|An icon to edit this story. If the user is not allowed to edit the icon, or their UI level is set too low, this variable will be empty.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'topStoryUrl' => {
|
||||
message => q|The URL to view the top story.|,
|
||||
context => q|Template variable.|,
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ KEY: foreach my $key (keys %{ $templateVars }) {
|
|||
delete $templateVars->{$key};
|
||||
}
|
||||
|
||||
$session->user({userId => 1});
|
||||
cmp_deeply(
|
||||
$templateVars,
|
||||
{
|
||||
|
|
@ -258,7 +259,7 @@ cmp_deeply(
|
|||
},
|
||||
]
|
||||
},
|
||||
'viewTemplateVariables: returns expected template variables with 3 stories in different folders'
|
||||
'viewTemplateVariables: returns expected template variables with 3 stories in different folders, user is cannot edit stories'
|
||||
);
|
||||
|
||||
my $story2 = $folder->addChild({ className => 'WebGUI::Asset::Story', title => 'Story 2', keywords => "roger,foxtrot"});
|
||||
|
|
@ -292,16 +293,22 @@ cmp_deeply(
|
|||
creationDate => ignore(),
|
||||
url => re('first-story'),
|
||||
title => 'First Story',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
{
|
||||
creationDate => ignore(),
|
||||
url => ignore(),
|
||||
title => 'Story 2',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
{
|
||||
creationDate => ignore(),
|
||||
url => ignore(),
|
||||
title => 'Story 3',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -336,11 +343,15 @@ cmp_deeply(
|
|||
creationDate => ignore(),
|
||||
url => ignore(),
|
||||
title => 'Story 2',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
{
|
||||
creationDate => ignore(),
|
||||
url => ignore(),
|
||||
title => 'Story 3',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -351,6 +362,8 @@ cmp_deeply(
|
|||
creationDate => ignore(),
|
||||
url => ignore(),
|
||||
title => 'WebGUI is released',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -383,11 +396,15 @@ cmp_bag(
|
|||
creationDate => ignore(),
|
||||
url => ignore(),
|
||||
title => 'Story 3',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
{
|
||||
creationDate => ignore(),
|
||||
url => ignore(),
|
||||
title => 'Story 4',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
@ -398,6 +415,8 @@ cmp_bag(
|
|||
creationDate => ignore(),
|
||||
url => ignore(),
|
||||
title => 'WebGUI is released',
|
||||
editIcon => ignore(),
|
||||
deleteIcon => ignore(),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue