Commit dd450aad authored by Alastair Pharo's avatar Alastair Pharo Committed by Alastair Pharo
Browse files

More blog functionality

parent 338fe622
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20061127" COMMENT="XMLDB file for Mahara's blog-related tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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
that isn't in the artefact table. -->
<TABLE NAME="artefact_blog_blogpost">
<FIELDS>
<FIELD NAME="blogpost" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="published" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" UNSIGNED="true" />
</FIELDS>
<KEYS>
<KEY NAME="blogpostpk" TYPE="primary" FIELDS="blogpost" />
<KEY NAME="blogpostfk" TYPE="foreign" FIELDS="blogpost" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<!-- This table relates artefacts of type 'blogpost' to artefacts of type
'file'. This is a many-many relation. -->
<TABLE NAME="artefact_blog_blogpost_file">
<FIELDS>
<FIELD NAME="blogpost" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="file" TYPE="int" LENGTH="10" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="blogpost_filepk" TYPE="primary" FIELDS="blogpost,file" />
<KEY NAME="blogpostfk" TYPE="foreign" FIELDS="blogpost" REFTABLE="artefact" REFFIELDS="id" />
<KEY NAME="filefk" TYPE="foreign" FIELDS="file" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
<?php
/**
* This program is part of Mahara
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage artefact-internal
* @author Alastair Pharo <alastair@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
defined('INTERNAL') || die();
function xmldb_artefact_blog_upgrade($oldversion=0) {
$status = true;
// There was no database prior to this version.
if ($oldversion < 2006120501) {
$status = $status && install_from_xmldb_file(
get_config('docroot') .
'artefact/blog/db/install.xml'
);
}
return $status;
}
?>
<?php
/**
* This program is part of Mahara
*
......
......@@ -51,7 +51,25 @@ $form = pieform(array(
'title' => get_string('blogdesc', 'artefact.blog'),
'description' => get_string('blogdescdesc', 'artefact.blog'),
'rules' => array(
'required' => true
'required' => false
)
),
'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')
)
),
'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')
)
),
'submit' => array(
......
......@@ -8,8 +8,6 @@
<div class="content">
<h2>{str section="artefact.blog" tag="newblog"}</h2>
{$newblogform}
ADD RADIO BUTTONS
</div>
{include file="footer.tpl"}
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2006112700;
$config->version = 2006120501;
$config->release = '0.1';
?>
......@@ -33,6 +33,7 @@ safe_require('artefact', 'blog');
$id = param_integer('id');
$enc_id = json_encode($id);
// This javascript is used to generate a list of blog posts.
$js = <<<EOJAVASCRIPT
var postlist = new TableRenderer(
......@@ -55,7 +56,6 @@ postlist.updateOnLoad();
EOJAVASCRIPT;
$blog = new ArtefactTypeBlog($id);
$smarty = smarty(array('tablerenderer'));
......
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