Commit 88cfe7c0 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Passing the objection=1 param to the objection url (Bug #1444925)"

parents d2de8500 a4f1dfe8
......@@ -1052,7 +1052,7 @@ class ActivityTypeInteractionForumReportPost extends ActivityTypePlugin {
$post->posttime = strftime(get_string('strftimedaydatetime'), $post->ctime);
$post->textbody = trim(html2text($post->body));
$post->htmlbody = clean_html($post->body);
$this->url = 'interaction/forum/topic.php?id=' . $post->topicid . '&post=' . $this->postid;
$this->url = 'interaction/forum/topic.php?id=' . $post->topicid . '&post=' . $this->postid . '&objection=1';
$this->add_urltext(array(
'key' => 'Topic',
......
......@@ -57,7 +57,9 @@ $maxindentdepth = isset($forumconfig['maxindent']) ? $forumconfig['maxindent']->
if (!$membership
&& !get_field('group', 'public', 'id', $topic->groupid)) {
throw new GroupAccessDeniedException(get_string('cantviewtopic', 'interaction.forum'));
$objection = param_integer('objection', 0);
$errorstr = ($objection) ? get_string('accessdeniedobjection', 'error') : get_string('cantviewtopic', 'interaction.forum');
throw new GroupAccessDeniedException($errorstr, $objection);
}
$topic->canedit = ($moderator || user_can_edit_post($topic->poster, $topic->ctime)) && $ineditwindow;
......
......@@ -87,6 +87,7 @@ $string['notfound'] = 'Not found';
$string['notfoundexception'] = 'The page you are looking for could not be found.';
$string['accessdenied'] = 'Access denied';
$string['accessdeniedobjection'] = 'Access denied - The objection has already been resolved by another administrator.';
$string['accessdeniedexception'] = 'You do not have access to view this page.';
$string['viewnotfoundexceptiontitle'] = 'Page not found';
......
......@@ -924,10 +924,10 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin {
}
if (empty($this->artefact)) {
$this->url = $this->view->get_url(false);
$this->url = $this->view->get_url(false) . '&objection=1';
}
else {
$this->url = 'artefact/artefact.php?artefact=' . $this->artefact->get('id') . '&view=' . $this->view->get('id');
$this->url = 'artefact/artefact.php?artefact=' . $this->artefact->get('id') . '&view=' . $this->view->get('id') . '&objection=1';
}
if (empty($this->strings->subject)) {
......@@ -959,14 +959,14 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin {
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
$this->message, $this->view->get_url() . "&objection=1", $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, get_config('wwwroot') . "artefact/artefact.php?artefact=" . $this->artefact->get('id') . "&view=" . $this->view->get('id'), $reporterurl
$this->message, get_config('wwwroot') . "artefact/artefact.php?artefact=" . $this->artefact->get('id') . "&view=" . $this->view->get('id') . "&objection=1", $reporterurl
);
}
}
......@@ -981,7 +981,7 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin {
return get_string_from_language(
$user->lang, 'objectionablecontentviewhtml', 'activity',
$viewtitle, $reportername, $ctime,
$message, $this->view->get_url(), $viewtitle,
$message, $this->view->get_url() . "&objection=1", $viewtitle,
$reporterurl, $reportername
);
}
......@@ -989,7 +989,7 @@ class ActivityTypeObjectionable extends ActivityTypeAdmin {
return get_string_from_language(
$user->lang, 'objectionablecontentviewartefacthtml', 'activity',
$viewtitle, hsc($this->artefact->get('title')), $reportername, $ctime,
$message, get_config('wwwroot') . "artefact/artefact.php?artefact=" . $this->artefact->get('id') . "&view=" . $this->view->get('id'), hsc($this->artefact->get('title')),
$message, get_config('wwwroot') . "artefact/artefact.php?artefact=" . $this->artefact->get('id') . "&view=" . $this->view->get('id') . "&objection=1", hsc($this->artefact->get('title')),
$reporterurl, $reportername
);
}
......
......@@ -917,7 +917,12 @@ class GroupAccessDeniedException extends AccessDeniedException {
$group = group_current_group();
if ($group->jointype == 'open'
|| get_record('group_member_invite', 'group', GROUP, 'member', $USER->get('id'))) {
$SESSION->add_error_msg(get_string('notmembermayjoin', 'group', $group->name));
$message = get_string('notmembermayjoin', 'group', $group->name);
// Error code equals 1 if we have objection=1 in url
if ($this->getCode() == '1') {
$message .= ' ' . get_string('accessdeniedobjection', 'error');
}
$SESSION->add_error_msg($message);
$next = substr($_SERVER['REQUEST_URI'], strlen(get_mahara_install_subdirectory()) - 1);
$goto = group_homepage_url($group);
$goto .= (strpos($goto, '?') ? '&' : '?') . 'next=' . urlencode($next);
......
......@@ -115,8 +115,13 @@ function objection_form_cancel_submit(Pieform $form) {
function notrude_form() {
global $USER, $view, $artefact;
$owner = $view->get('owner');
if (!(($owner && ($USER->get('admin') || $USER->is_admin_for_user($owner)))
|| ($view->get('group') && $USER->get('admin')))) {
if (!
(
($owner && ($USER->get('admin') || $USER->is_admin_for_user($owner)))
|| ($view->get('group') && $USER->get('admin'))
|| ($view->get('group') && group_user_access($view->get('group'), $USER->get('id')) == 'admin')
)
) {
return;
}
......
......@@ -68,7 +68,8 @@ if (!isset($view)) {
}
if (!can_view_view($view)) {
throw new AccessDeniedException(get_string('accessdenied', 'error'));
$errorstr = (param_integer('objection', null)) ? get_string('accessdeniedobjection', 'error') : get_string('accessdenied', 'error');
throw new AccessDeniedException($errorstr);
}
else {
// To save the atime in the db - make it a millisecond in the past
......
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