Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
5a7e9f6b
Commit
5a7e9f6b
authored
Nov 19, 2014
by
Robert Lyon
Committed by
Gerrit Code Review
Nov 19, 2014
Browse files
Merge "Allowing each blogpost in blog block to show comments (Bug #1037531)"
parents
ab7a0fb2
4fc7736e
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/blog/blocktype/blog/lib.php
View file @
5a7e9f6b
...
...
@@ -72,6 +72,7 @@ class PluginBlocktypeBlog extends PluginBlocktype {
'jsonscript'
=>
'artefact/blog/posts.json.php'
,
);
}
$configdata
[
'blockid'
]
=
$instance
->
get
(
'id'
);
ArtefactTypeBlogpost
::
render_posts
(
$posts
,
$template
,
$configdata
,
$pagination
);
$smarty
=
smarty_core
();
...
...
htdocs/artefact/blog/lib.php
View file @
5a7e9f6b
...
...
@@ -810,11 +810,9 @@ class ArtefactTypeBlogPost extends ArtefactType {
require_once
(
get_config
(
'docroot'
)
.
'lib/view.php'
);
$view
=
new
View
(
$viewoptions
[
'viewid'
]);
$artefact
=
artefact_instance_from_id
(
$post
->
id
);
$commentoptions
=
ArtefactTypeComment
::
get_comment_options
();
$commentoptions
->
view
=
$view
;
$commentoptions
->
artefact
=
$artefact
;
$comments
=
ArtefactTypeComment
::
get_comments
(
$commentoptions
);
$post
->
commentcount
=
isset
(
$comments
->
count
)
?
$comments
->
count
:
0
;
list
(
$commentcount
,
$comments
)
=
ArtefactTypeComment
::
get_artefact_comments_for_view
(
$artefact
,
$view
,
null
,
false
);
$post
->
commentcount
=
$commentcount
;
$post
->
comments
=
$comments
;
}
}
$post
->
ctime
=
format_date
(
$post
->
ctime
,
'strftimedaydatetime'
);
...
...
htdocs/artefact/comment/lib.php
View file @
5a7e9f6b
...
...
@@ -509,7 +509,7 @@ class ArtefactTypeComment extends ArtefactType {
* or the html to render them.
*/
public
function
get_artefact_comments_for_view
(
$artefact
,
$view
,
$blockid
,
$html
=
true
)
{
if
(
empty
(
$blockid
)
||
!
is_object
(
$artefact
)
||
!
is_object
(
$view
))
{
if
(
!
is_object
(
$artefact
)
||
!
is_object
(
$view
))
{
throw
new
MaharaException
(
'we do not have the right information to display the comments'
);
}
...
...
htdocs/theme/raw/artefact/blog/templates/viewposts.tpl
View file @
5a7e9f6b
...
...
@@ -35,6 +35,24 @@
</tbody>
</table>
{/
if
}
{
if
$options.viewid
&&
$post
->
allowcomments
}
<div
class=
"postdetails"
><a
href=
"
{
$WWWROOT
}
artefact/artefact.php?artefact=
{
$post
->
id
}
&view=
{
$options.viewid
}
"
>
{
str
tag
=
Comments
section
=
artefact
.
comment
}
(
{
$post
->
commentcount
}
)
</a></div>
{/
if
}
{
if
$options.viewid
&&
(
$post
->
commentcount
||
$post
->
commentcount
===
0
)
}
<div
class=
"comments"
>
{
if
$post
->
commentcount
>
0
}
<a
id=
"block_0
{
$post
->
id
}{
$options.blockid
}
"
class=
"commentlink"
href=
"
{
$WWWROOT
}
artefact/artefact.php?artefact=
{
$post
->
id
}
&view=
{
$options.viewid
}
"
>
{
str
tag
=
Comments
section
=
artefact
.
comment
}
(
{
$post
->
commentcount
}
)
</a>
{
else
}
{
if
$post
->
allowcomments
}
<span
class=
"nocomments"
>
{
str
tag
=
Comments
section
=
artefact
.
comment
}
(
{
$post
->
commentcount
}
)
</span>
{/
if
}
{/
if
}
{
if
$post
->
allowcomments
}
<a
class=
"addcomment bar-before"
href=
"
{
$WWWROOT
}
artefact/artefact.php?artefact=
{
$post
->
id
}
&view=
{
$options.viewid
}
"
>
{
str
tag
=
addcomment
section
=
artefact
.
comment
}
</a>
{/
if
}
</div>
<div
class=
"feedbacktablewrapper"
>
<div
id=
"feedbacktable_0
{
$post
->
id
}{
$options.blockid
}
"
class=
"feedbacktable"
>
{
$post
->
comments
->
tablerows
|
safe
}
</div>
</div>
{/
if
}
</div>
{/
foreach
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment