Commit 94d5ed0b authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add checkbox to turn blog post comments on/off


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent e3066c1b
......@@ -34,6 +34,7 @@ $string['blogs'] = 'Blogs';
$string['addblog'] = 'Add Blog';
$string['addpost'] = 'Add Post';
$string['alignment'] = 'Alignment';
$string['allowcommentsonpost'] = 'Allow comments on your post.';
$string['attach'] = 'Attach';
$string['attachedfilelistloaded'] = 'Attached file list loaded';
$string['attachedfiles'] = 'Attached files';
......@@ -54,14 +55,6 @@ $string['blogtitle'] = 'Title';
$string['blogtitledesc'] = 'e.g., ‘Jill’s Nursing Practicum Journal’.';
$string['border'] = 'Border';
$string['cancel'] = 'Cancel';
$string['commentsallowed'] = 'Comments';
$string['commentsalloweddesc'] = ' ';
$string['commentsallowedno'] = 'Do not allow comments on this blog';
$string['commentsallowedyes'] = 'Allow logged in users to comment on this blog';
$string['commentsnotify'] = 'Comment Notification';
$string['commentsnotifydesc'] = 'You can optionally receive notification whenever someone adds a comment to one of your blog posts.';
$string['commentsnotifyno'] = 'Do not notify me of comments to this blog';
$string['commentsnotifyyes'] = 'Notify me of comments to this blog';
$string['createandpublishdesc'] = 'This will create the blog post and make it available to others.';
$string['createasdraftdesc'] = 'This will create the blog post, but it will not become available to others until you choose to publish it.';
$string['createblog'] = 'Create Blog';
......
......@@ -156,6 +156,12 @@ $form = pieform(array(
'defaultvalue' => $checked,
'help' => true,
),
'allowcomments' => array(
'type' => 'checkbox',
'title' => get_string('allowcomments','artefact.comment'),
'description' => get_string('allowcommentsonpost','artefact.blog'),
'defaultvalue' => $blogpost ? $blogpostobj->get('allowcomments') : 1,
),
'submitpost' => array(
'type' => 'submitcancel',
'value' => array(get_string('savepost', 'artefact.blog'), get_string('cancel')),
......@@ -355,6 +361,7 @@ function editpost_submit(Pieform $form, $values) {
$postobj->set('description', $values['description']);
$postobj->set('tags', $values['tags']);
$postobj->set('published', !$values['draft']);
$postobj->set('allowcomments', (int) $values['allowcomments']);
if (!$blogpost) {
$postobj->set('parent', $blog);
$postobj->set('owner', $USER->id);
......
......@@ -32,6 +32,7 @@ $string['Comments'] = 'Comments';
$string['comment'] = 'comment';
$string['comments'] = 'comments';
$string['allowcomments'] = 'Allow comments';
$string['attachfile'] = "Attach file";
$string['Attachments'] = "Attachments";
$string['cantedithasreplies'] = 'You can only edit the most recent comment';
......
......@@ -42,8 +42,7 @@ $string['stopdate'] = 'Access End Date/Time';
$string['stopdatecannotbeinpast'] = 'The stop date cannot be in the past';
$string['startdatemustbebeforestopdate'] = 'The start date must be before the stop date';
$string['unrecogniseddateformat'] = 'Unrecognised date format';
$string['enablecomments'] = 'Enable comments';
$string['enablecommentsdescription'] = 'If checked, users who can see your View will be allowed to leave comments.';
$string['allowcommentsonview'] = 'If checked, users who can see your View will be allowed to leave comments.';
$string['ownerformat'] = 'Name display format';
$string['ownerformatdescription'] = 'How do you want people who look at your View to see your name?';
$string['profileviewtitle'] = 'Profile view';
......
......@@ -136,8 +136,8 @@ if (!($group || $institution)) {
$editview['elements']['allowcomments'] = array(
'type' => 'checkbox',
'title' => get_string('enablecomments','view'),
'description' => get_string('enablecommentsdescription','view'),
'title' => get_string('allowcomments','artefact.comment'),
'description' => get_string('allowcommentsonview','view'),
'defaultvalue' => $view->get('allowcomments'),
);
......
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