Skip to content

Commit f0513b3

Browse files
Merge pull request #5509 from christianbeeznest/ofaj-21685
Internal: Fix access issues in HTML block links for images and documents - refs BT#21685
2 parents 7b51cc5 + 6eeca0d commit f0513b3

File tree

5 files changed

+17
-21
lines changed

5 files changed

+17
-21
lines changed

src/CoreBundle/Resources/views/Resource/preview.html.twig

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
"{{ url(
1212
'chamilo_core_resource_view', {
1313
'id': resource.resourceNode.id,
14-
'cid': course ? course.id : 0,
15-
'sid': session ? session.id : 0,
1614
'type' : type,
1715
'tool' : tool,
1816
'filter' : 'resource_show_preview'
@@ -23,8 +21,6 @@
2321
{% autoescape false %}
2422
<iframe border="0" frameborder="0" style="width:100%;height:600px" src="{{ url('chamilo_core_resource_view', {
2523
'id': resource.resourceNode.id,
26-
'cid': course ? course.id : 0,
27-
'sid': session ? session.id : 0,
2824
'type' : type,
2925
'tool' : tool
3026
}
@@ -39,8 +35,6 @@
3935
<a
4036
href="{{ url('chamilo_core_resource_download', {
4137
'id': resource.resourceNode.id,
42-
'cid': course ? course.id : 0,
43-
'sid': session ? session.id : 0,
4438
'type' : type,
4539
'tool' : tool
4640
}

src/CoreBundle/Resources/views/Resource/toolbar_view_resource.html.twig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<a class="btn btn--success"
55
href="{{ url('chamilo_core_resource_view', {
66
'id': resource.resourceNode.id,
7-
'cid': course.id,
8-
'sid': session.id,
97
'type' : type,
108
'tool' : tool,
119
'mode' : 'download'

src/CoreBundle/Resources/views/Work/comments.html.twig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
<a
2828
href="{{ url('chamilo_core_resource_view', {
2929
'id': comment.resourceNode.id,
30-
'cid': course ? course.id : 0,
31-
'sid': session ? session.id : 0,
3230
'type' : 'student_publications_comments',
3331
'tool' : 'student_publications',
3432
})
@@ -65,4 +63,4 @@
6563
</ul>
6664
<br />
6765

68-
{% endautoescape %}
66+
{% endautoescape %}

src/CoreBundle/Resources/views/Work/view.html.twig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
<a class="btn btn--success"
2525
href="{{ url('chamilo_core_resource_view', {
2626
'id': work.resourceNode.id,
27-
'cid': course ? course.id : 0,
28-
'sid': session ? session.id : 0,
2927
'tool' : 'student_publication',
3028
'type' : 'student_publications',
3129
'mode' : 'download'

src/CoreBundle/Serializer/ResourceNormalizer.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,22 @@ public function normalize(
6464
if ($object->hasResourceNode()) {
6565
$resourceNode = $object->getResourceNode();
6666

67-
$params = [
68-
'id' => $resourceNode->getUuid(),
69-
'cid' => $courseId,
70-
'sid' => $sessionId,
71-
'gid' => $groupId,
72-
'tool' => $resourceNode->getResourceType()->getTool()->getTitle(),
73-
'type' => $resourceNode->getResourceType()->getTitle(),
74-
];
67+
if ($resourceNode->hasResourceFile()) {
68+
$params = [
69+
'id' => $resourceNode->getUuid(),
70+
'tool' => $resourceNode->getResourceType()->getTool()->getTitle(),
71+
'type' => $resourceNode->getResourceType()->getTitle(),
72+
];
73+
} else {
74+
$params = [
75+
'id' => $resourceNode->getUuid(),
76+
'cid' => $courseId,
77+
'sid' => $sessionId,
78+
'gid' => $groupId,
79+
'tool' => $resourceNode->getResourceType()->getTool()->getTitle(),
80+
'type' => $resourceNode->getResourceType()->getTitle(),
81+
];
82+
}
7583

7684
// if ($getFile) {
7785
// Get all links from resource.

0 commit comments

Comments
 (0)