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
531ec92b
Commit
531ec92b
authored
Feb 19, 2014
by
Aaron Wells
Browse files
Show date & forum name in Elasticsearch forum post search results
Bug 1281847 Change-Id: I8c87b77af8e42f2d405389c07b5b3bf2e8adbd44
parent
b7063ffa
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/search/elasticsearch/lang/en.utf8/search.elasticsearch.php
View file @
531ec92b
...
...
@@ -35,6 +35,8 @@ $string['deletedforumpost'] = 'Deleted forum post';
$string
[
'filterresultsby'
]
=
'Filter results by'
;
$string
[
'forum'
]
=
'Forum'
;
$string
[
'forumpost'
]
=
'Forum post'
;
$string
[
'forumpostedbylabel'
]
=
'Posted by'
;
$string
[
'forumpostedby'
]
=
'%s on %s'
;
$string
[
'forumtopic'
]
=
'Forum topic'
;
$string
[
'Group'
]
=
'Group'
;
$string
[
'host'
]
=
'Host'
;
...
...
htdocs/search/elasticsearch/theme/raw/interaction_forum_post.tpl
View file @
531ec92b
...
...
@@ -2,6 +2,7 @@
<h3
class=
"title"
>
$record->subject
<span
class=
"artefacttype"
>
(
{
str
tag
=
deletedforumpost
section
=
search
.
elasticsearch
}
)
</span></h3>
{
else
}
<h3
class=
"title"
><a
href=
"
{
$WWWROOT
}
interaction/forum/topic.php?id=
{
$record
->
topic
}
#post
{
$record
->
id
}
"
>
{
$record
->
subject
}
</a>
<span
class=
"artefacttype"
>
(
{
str
tag
=
forumpost
section
=
search
.
elasticsearch
}
)
</span></h3>
<div
class=
"source"
><label>
{
str
tag
=
'forum'
section
=
'search.elasticsearch'
}
:
</label>
{
$record
->
forumname
}
(
{
$record
->
groupname
}
)
</div>
<div
class=
"poster"
><label>
{
str
tag
=
'forumpostedbylabel'
section
=
'search.elasticsearch'
}
:
</label>
{
str
tag
=
forumpostedby
section
=
search
.
elasticsearch
arg1
=
'$record->authorlink|safe'
arg2
=
'$record->ctime'
}
</div>
<div
class=
"detail"
>
{
$record
->
body
|
str_shorten_html
:
140
:
true
:
false
|
safe
}
</div>
<div
class=
"poster"
><a
href=
"
{
profile_url
(
$record
->
poster
)
}
"
class=
"forumuser"
>
{
$record
->
poster
|
display_name
:
null
:
true
}
</a></div>
{/
if
}
\ No newline at end of file
htdocs/search/elasticsearch/type/ElasticsearchType_interaction_forum_post.php
View file @
531ec92b
...
...
@@ -103,10 +103,15 @@ class ElasticsearchType_interaction_forum_post extends ElasticsearchType
$sql
=
'SELECT p1.id, p1.topic, p1.parent, p1.poster, COALESCE(p1.subject, p2.subject) AS subject, p2.subject,
p1.body, p1.ctime, p1.deleted, p1.sent, p1.path,
u.username, u.preferredname, u.firstname, u.lastname, u.profileicon
u.username, u.preferredname, u.firstname, u.lastname, u.profileicon,
f.title as forumname, f.id as forumid,
g.name as groupname, g.id as groupid
FROM {interaction_forum_post} p1
LEFT JOIN {interaction_forum_post} p2 ON p2.parent IS NULL AND p2.topic = p1.topic
LEFT JOIN {usr} u ON u.id = p1.poster
LEFT JOIN {interaction_forum_topic} ift on p1.topic = ift.id
LEFT JOIN {interaction_instance} f ON ift.forum = f.id AND f.plugin=\'forum\'
LEFT JOIN {group} g ON f.group = g.id
WHERE p1.id = ?'
;
$record
=
get_record_sql
(
$sql
,
array
(
$id
));
...
...
@@ -115,7 +120,8 @@ class ElasticsearchType_interaction_forum_post extends ElasticsearchType
}
$record
->
body
=
str_replace
(
array
(
"
\r\n
"
,
"
\n
"
,
"
\r
"
),
' '
,
strip_tags
(
$record
->
body
));
$record
->
ctime
=
format_date
(
strtotime
(
$record
->
ctime
));
$record
->
authorlink
=
'<a href="'
.
profile_url
(
$record
->
poster
)
.
'" class="forumuser">'
.
display_name
(
$record
->
poster
,
null
,
true
)
.
'</a>'
;
return
$record
;
}
...
...
Write
Preview
Markdown
is supported
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