Skip to content

Commit

Permalink
Merge pull request #5509 from christianbeeznest/ofaj-21685
Browse files Browse the repository at this point in the history
Internal: Fix access issues in HTML block links for images and documents - refs BT#21685
  • Loading branch information
christianbeeznest committed May 15, 2024
2 parents 7b51cc5 + 6eeca0d commit f0513b3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
6 changes: 0 additions & 6 deletions src/CoreBundle/Resources/views/Resource/preview.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"{{ url(
'chamilo_core_resource_view', {
'id': resource.resourceNode.id,
'cid': course ? course.id : 0,
'sid': session ? session.id : 0,
'type' : type,
'tool' : tool,
'filter' : 'resource_show_preview'
Expand All @@ -23,8 +21,6 @@
{% autoescape false %}
<iframe border="0" frameborder="0" style="width:100%;height:600px" src="{{ url('chamilo_core_resource_view', {
'id': resource.resourceNode.id,
'cid': course ? course.id : 0,
'sid': session ? session.id : 0,
'type' : type,
'tool' : tool
}
Expand All @@ -39,8 +35,6 @@
<a
href="{{ url('chamilo_core_resource_download', {
'id': resource.resourceNode.id,
'cid': course ? course.id : 0,
'sid': session ? session.id : 0,
'type' : type,
'tool' : tool
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<a class="btn btn--success"
href="{{ url('chamilo_core_resource_view', {
'id': resource.resourceNode.id,
'cid': course.id,
'sid': session.id,
'type' : type,
'tool' : tool,
'mode' : 'download'
Expand Down
4 changes: 1 addition & 3 deletions src/CoreBundle/Resources/views/Work/comments.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
<a
href="{{ url('chamilo_core_resource_view', {
'id': comment.resourceNode.id,
'cid': course ? course.id : 0,
'sid': session ? session.id : 0,
'type' : 'student_publications_comments',
'tool' : 'student_publications',
})
Expand Down Expand Up @@ -65,4 +63,4 @@
</ul>
<br />

{% endautoescape %}
{% endautoescape %}
2 changes: 0 additions & 2 deletions src/CoreBundle/Resources/views/Work/view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
<a class="btn btn--success"
href="{{ url('chamilo_core_resource_view', {
'id': work.resourceNode.id,
'cid': course ? course.id : 0,
'sid': session ? session.id : 0,
'tool' : 'student_publication',
'type' : 'student_publications',
'mode' : 'download'
Expand Down
24 changes: 16 additions & 8 deletions src/CoreBundle/Serializer/ResourceNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,22 @@ public function normalize(
if ($object->hasResourceNode()) {
$resourceNode = $object->getResourceNode();

$params = [
'id' => $resourceNode->getUuid(),
'cid' => $courseId,
'sid' => $sessionId,
'gid' => $groupId,
'tool' => $resourceNode->getResourceType()->getTool()->getTitle(),
'type' => $resourceNode->getResourceType()->getTitle(),
];
if ($resourceNode->hasResourceFile()) {
$params = [
'id' => $resourceNode->getUuid(),
'tool' => $resourceNode->getResourceType()->getTool()->getTitle(),
'type' => $resourceNode->getResourceType()->getTitle(),
];
} else {
$params = [
'id' => $resourceNode->getUuid(),
'cid' => $courseId,
'sid' => $sessionId,
'gid' => $groupId,
'tool' => $resourceNode->getResourceType()->getTool()->getTitle(),
'type' => $resourceNode->getResourceType()->getTitle(),
];
}

// if ($getFile) {
// Get all links from resource.
Expand Down

0 comments on commit f0513b3

Please sign in to comment.