Commit b2fcdcea authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

removing settings for public comments and notifications from blogs

parent 68f29f41
......@@ -4,21 +4,6 @@
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<!-- This table is supposed to have a 1-1 relation with every row in the
artefact table with artefacttype = 'blog'. It contains additional
information that isn't in the artefact table. -->
<TABLE NAME="artefact_blog_blog">
<FIELDS>
<FIELD NAME="blog" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="commentsallowed" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="true" />
<FIELD NAME="commentsnotify" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="true" />
</FIELDS>
<KEYS>
<KEY NAME="blogpk" TYPE="primary" FIELDS="blog" />
<KEY NAME="blogfk" TYPE="foreign" FIELDS="blog" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<!-- This table is supposed to have a 1-1 relation with every row in the
artefact table with artefacttype = 'blogpost'. It contains additional data
......
......@@ -92,7 +92,10 @@ function xmldb_artefact_blog_upgrade($oldversion=0) {
}
}
}
if ($oldversion < 2008020700) {
$table = new XMLDBTable('artefact_blog_blog');
drop_table($table);
}
return $status;
}
......
<h3>Comments</h3>
<p>You can choose whether or not to allow other logged in users to submit Comments on postings within this Blog.</p>
<h3>Comment Notification</h3>
<p>You can choose whether you receive notification of new Comments submitted on your Blog. How you receive Blog Comment Notification will be determined by your setting for Feedback messages within your Account and Activity Preferences.</p>
......@@ -114,21 +114,7 @@ class ArtefactTypeBlog extends ArtefactType {
* This constant gives the per-page pagination for listing blogs.
*/
const pagination = 10;
/**
* Whether comments are allowed on this blog or not.
*
* @var boolean
*/
protected $commentsallowed = false;
/**
* Whether the blog owner will be notified of comments or not.
*
* @var boolean
*/
protected $commentsnotify = false;
/**
* We override the constructor to fetch the extra data.
......@@ -138,19 +124,6 @@ class ArtefactTypeBlog extends ArtefactType {
*/
public function __construct($id = 0, $data = null) {
parent::__construct($id, $data);
if ($this->id) {
if ($blogdata = get_record('artefact_blog_blog', 'blog', $this->id)) {
foreach($blogdata as $name => $value) {
if (property_exists($this, $name)) {
$this->$name = $value;
}
}
}
else {
// This should never happen unless the user is playing around with blog IDs in the location bar or similar
throw new ArtefactNotFoundException(get_string('blogdoesnotexist', 'artefact.blog'));
}
}
if (empty($this->id)) {
$this->container = 1;
......@@ -178,22 +151,6 @@ class ArtefactTypeBlog extends ArtefactType {
// Commit to the artefact table.
parent::commit();
// Reset dirtyness for the time being.
$this->dirty = true;
$data = (object)array(
'blog' => $this->get('id'),
'commentsallowed' => ($this->get('commentsallowed') ? 1 : 0),
'commentsnotify' => ($this->get('commentsnotify') ? 1 : 0)
);
if ($new) {
insert_record('artefact_blog_blog', $data);
}
else {
update_record('artefact_blog_blog', $data, 'blog');
}
$this->dirty = false;
}
......@@ -206,9 +163,6 @@ class ArtefactTypeBlog extends ArtefactType {
return;
}
// Delete the blog-specific data.
delete_records('artefact_blog_blog', 'blog', $this->id);
// Delete the artefact and all children.
parent::delete();
}
......@@ -316,8 +270,6 @@ class ArtefactTypeBlog extends ArtefactType {
$artefact->set('title', $values['title']);
$artefact->set('description', $values['description']);
$artefact->set('owner', $user->get('id'));
$artefact->set('commentsallowed', $values['commentsallowed'] ? true : false);
$artefact->set('commentsnotify', $values['commentsnotify'] ? true : false);
$artefact->set('tags', $values['tags']);
$artefact->commit();
}
......@@ -340,21 +292,10 @@ class ArtefactTypeBlog extends ArtefactType {
$artefact->set('title', $values['title']);
$artefact->set('description', $values['description']);
$artefact->set('commentsallowed', $values['commentsallowed'] ? true : false);
$artefact->set('commentsnotify', $values['commentsnotify'] ? true : false);
$artefact->set('tags', $values['tags']);
$artefact->commit();
}
public function public_feedback_allowed() {
return $this->get('commentsallowed');
}
public function feedback_notify_owner() {
return $this->get('commentsnotify');
}
public static function get_links($id) {
$wwwroot = get_config('wwwroot');
......@@ -792,21 +733,6 @@ class ArtefactTypeBlogPost extends ArtefactType {
}
return $list;
}
public function public_feedback_allowed() {
// Comments are not allowed on posts when the blog has
// commentsallowed set to 0;
$parent = get_field('artefact', 'parent', 'id', $this->get('id'));
return get_field('artefact_blog_blog', 'commentsallowed', 'blog', $parent);
}
public function feedback_notify_owner() {
// Notify owner of comments on posts when the blog has
// commentsnotify set to 1;
$parent = get_field('artefact', 'parent', 'id', $this->get('id'));
return get_field('artefact_blog_blog', 'commentsnotify', 'blog', $parent);
}
public static function get_links($id) {
$wwwroot = get_config('wwwroot');
......
......@@ -64,26 +64,6 @@ $form = pieform(array(
'description' => get_string('tagsdescprofile'),
'help' => true,
),
'commentsallowed' => array(
'type' => 'radio',
'title' => get_string('commentsallowed', 'artefact.blog'),
'description' => get_string('commentsalloweddesc', 'artefact.blog'),
'options' => array(
0 => get_string('commentsallowedno', 'artefact.blog'),
1 => get_string('commentsallowedyes', 'artefact.blog')
),
'help' => true,
),
'commentsnotify' => array(
'type' => 'radio',
'title' => get_string('commentsnotify', 'artefact.blog'),
'description' => get_string('commentsnotifydesc', 'artefact.blog'),
'options' => array(
0 => get_string('commentsnotifyno', 'artefact.blog'),
1 => get_string('commentsnotifyyes', 'artefact.blog')
),
'help' => true,
),
'submit' => array(
'type' => 'submitcancel',
'value' => array(
......
......@@ -73,26 +73,6 @@ $form = pieform(array(
'description' => get_string('tagsdescprofile'),
'help' => true,
),
'commentsallowed' => array(
'type' => 'radio',
'title' => get_string('commentsallowed', 'artefact.blog'),
'description' => get_string('commentsalloweddesc', 'artefact.blog'),
'options' => array(
0 => get_string('commentsallowedno', 'artefact.blog'),
1 => get_string('commentsallowedyes', 'artefact.blog')
),
'defaultvalue' => ($blog->get('commentsallowed') ? 1 : 0)
),
'commentsnotify' => array(
'type' => 'radio',
'title' => get_string('commentsnotify', 'artefact.blog'),
'description' => get_string('commentsnotifydesc', 'artefact.blog'),
'options' => array(
0 => get_string('commentsnotifyno', 'artefact.blog'),
1 => get_string('commentsnotifyyes', 'artefact.blog')
),
'defaultvalue' => ($blog->get('commentsnotify') ? 1 : 0)
),
'submit' => array(
'type' => 'submitcancel',
'value' => array(
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2008012200;
$config->version = 2008020700;
$config->release = '0.1.1';
?>
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