Commit ec47424f authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Send objectionable activity notifications in html (bug #666546)


Include time of report in notification
Include link to profile of reporter of objectionable content

Change-Id: I32b893d996ae7760f36c17c0f1100513e9fee7c4
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent cc1f4657
......@@ -87,6 +87,46 @@ $string['ownedby'] = 'owned by';
$string['objectionablecontentview'] = 'Objectionable content on Page "%s" reported by %s';
$string['objectionablecontentviewartefact'] = 'Objectionable content on Page "%s" in "%s" reported by %s';
$string['objectionablecontentviewhtml'] = '<div style="padding: 0.5em 0; border-bottom: 1px solid #999;">Objectionable content on "%s" reported by %s<strong></strong><br>%s</div>
<div style="margin: 1em 0;">%s</div>
<div style="font-size: smaller; border-top: 1px solid #999;">
<p>Complaint relates to: <a href="%s">%s</a></p>
<p>Reported by: <a href="%s">%s</a></p>
</div>';
$string['objectionablecontentviewtext'] = 'Objectionable content on "%s" reported by %s
%s
------------------------------------------------------------------------
%s
------------------------------------------------------------------------
To see the page, follow this link:
%s
To see the reporter\'s profile, follow this link:
%s';
$string['objectionablecontentviewartefacthtml'] = '<div style="padding: 0.5em 0; border-bottom: 1px solid #999;">Objectionable content on "%s" in "%s" reported by %s<strong></strong><br>%s</div>
<div style="margin: 1em 0;">%s</div>
<div style="font-size: smaller; border-top: 1px solid #999;">
<p>Complaint relates to: <a href="%s">%s</a></p>
<p>Reported by: <a href="%s">%s</a></p>
</div>';
$string['objectionablecontentviewartefacttext'] = 'Objectionable content on "%s" in "%s" reported by %s
%s
------------------------------------------------------------------------
%s
------------------------------------------------------------------------
To see the page, follow this link:
%s
To see the reporter\'s profile, follow this link:
%s';
$string['newgroupmembersubj'] = '%s is now a group member!';
$string['removedgroupmembersubj'] = '%s is no longer a group member';
......
......@@ -550,6 +550,7 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin {
protected $view;
protected $artefact;
protected $reporter;
protected $ctime;
/**
* @param array $data Parameters:
......@@ -557,6 +558,7 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin {
* - view (int)
* - artefact (int) (optional)
* - reporter (int)
* - ctime (int) (optional)
*/
function __construct($data, $cron=false) {
parent::__construct($data, $cron);
......@@ -584,6 +586,7 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin {
}
if (empty($this->strings->subject)) {
$this->overridemessagecontents = true;
$viewtitle = $this->view->get('title');
if (empty($this->artefact)) {
$this->strings->subject = (object) array(
......@@ -603,6 +606,49 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin {
}
}
public function get_emailmessage($user) {
$reporterurl = get_config('wwwroot') . 'user/view.php?id=' . $this->reporter;
$ctime = strftime(get_string_from_language($user->lang, 'strftimedaydatetime'), $this->ctime);
if (empty($this->artefact)) {
return get_string_from_language(
$user->lang, 'objectionablecontentviewtext', 'activity',
$this->view->get('title'), display_default_name($this->reporter), $ctime,
$this->message, $this->view->get_url(), $reporterurl
);
}
else {
return get_string_from_language(
$user->lang, 'objectionablecontentviewartefacttext', 'activity',
$this->view->get('title'), $this->artefact->get('title'), display_default_name($this->reporter), $ctime,
$this->message, $this->view->get_url(), $reporterurl
);
}
}
public function get_htmlmessage($user) {
$viewtitle = hsc($this->view->get('title'));
$reportername = hsc(display_default_name($this->reporter));
$reporterurl = get_config('wwwroot') . 'user/view.php?id=' . $this->reporter;
$ctime = strftime(get_string_from_language($user->lang, 'strftimedaydatetime'), $this->ctime);
$message = hsc($this->message);
if (empty($this->artefact)) {
return get_string_from_language(
$user->lang, 'objectionablecontentviewhtml', 'activity',
$viewtitle, $reportername, $ctime,
$message, $this->view->get_url(), $viewtitle,
$reporterurl, $reportername
);
}
else {
return get_string_from_language(
$user->lang, 'objectionablecontentviewartefacthtml', 'activity',
$viewtitle, hsc($this->artefact->get('title')), $reportername, $ctime,
$message, $this->view->get_url(), $viewtitle,
$reporterurl, $reportername
);
}
}
public function get_required_parameters() {
return array('message', 'view', 'reporter');
}
......
......@@ -3940,6 +3940,7 @@ function objection_form_submit(Pieform $form, $values) {
$data->view = $view->get('id');
$data->message = $values['message'];
$data->reporter = $USER->get('id');
$data->ctime = time();
if ($artefact) {
$data->artefact = $artefact->get('id');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment