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

Fixed breadcrumbs, titles + minor stuff

parent 76e681b7
...@@ -32,30 +32,18 @@ require_once('group.php'); ...@@ -32,30 +32,18 @@ require_once('group.php');
$postid = param_integer('id'); $postid = param_integer('id');
$post = get_record_sql( $post = get_record_sql(
'SELECT p.subject, p.body, p.topic, p.parent, p.poster, t.forum, p2.subject as topicsubject, f.group, f.title as forumtitle, COUNT(p3.*) 'SELECT p.subject, p.body, p.topic, p.parent, p.poster, t.forum, p2.subject as topicsubject, f.group, f.title as forumtitle, g.name as groupname, COUNT(p3.*)
FROM {interaction_forum_post} p FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t INNER JOIN {interaction_forum_topic} t ON (p.topic = t.id AND t.deleted != 1)
ON p.topic = t.id INNER JOIN {interaction_forum_post} p2 ON (p2.topic = t.id AND p2.parent IS NULL)
AND t.deleted != 1 INNER JOIN {interaction_instance} f ON (t.forum = f.id AND f.deleted != 1)
INNER JOIN {interaction_forum_post} p2 INNER JOIN {group} g ON g.id = f.group
ON p2.topic = t.id INNER JOIN {interaction_forum_post} p3 ON (p.poster = p3.poster AND p3.deleted) != 1
AND p2.parent IS NULL INNER JOIN {interaction_forum_topic} t2 ON (t2.deleted != 1 AND p3.topic = t2.id)
INNER JOIN {interaction_instance} f INNER JOIN {interaction_instance} f2 ON (t2.forum = f2.id AND f2.deleted != 1 AND f2.group = f.group)
ON t.forum = f.id
AND f.deleted != 1
INNER JOIN {interaction_forum_post} p3
ON p.poster = p3.poster
AND p3.deleted != 1
INNER JOIN {interaction_forum_topic} t2
ON t2.deleted != 1
AND p3.topic = t2.id
INNER JOIN {interaction_instance} f2
ON t2.forum = f2.id
AND f2.deleted != 1
AND f2.group = f.group
WHERE p.id = ? WHERE p.id = ?
AND p.deleted != 1 AND p.deleted != 1
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9', GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10',
array($postid) array($postid)
); );
...@@ -76,23 +64,25 @@ if (!$moderator) { ...@@ -76,23 +64,25 @@ if (!$moderator) {
define('TITLE', get_string('deletepostvariable', 'interaction.forum', $post->subject)); define('TITLE', get_string('deletepostvariable', 'interaction.forum', $post->subject));
$breadcrumbs = array( $breadcrumbs = array(
array(
get_config('wwwroot') . 'group/view.php?id=' . $post->group,
$post->groupname,
),
array( array(
get_config('wwwroot') . 'interaction/forum/index.php?group=' . $post->group, get_config('wwwroot') . 'interaction/forum/index.php?group=' . $post->group,
get_string('nameplural', 'interaction.forum') get_string('nameplural', 'interaction.forum')
), ),
array( array(
array( get_config('wwwroot') . 'interaction/forum/view.php?id=' . $post->forum,
get_config('wwwroot') . 'interaction/forum/view.php?id=' . $post->forum, $post->forumtitle
$post->forumtitle ),
), array(
array( get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $post->topic,
get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $post->topic, $post->topicsubject
$post->topicsubject ),
), array(
array( get_config('wwwroot') . 'interaction/forum/deletepost.php?id=' . $postid,
get_config('wwwroot') . 'interaction/forum/deletepost.php?id=' . $postid, get_string('deletepost', 'interaction.forum')
get_string('deletepost', 'interaction.forum')
)
) )
); );
......
...@@ -32,27 +32,17 @@ require('group.php'); ...@@ -32,27 +32,17 @@ require('group.php');
$topicid = param_integer('id'); $topicid = param_integer('id');
$topic = get_record_sql( $topic = get_record_sql(
'SELECT f."group", f.id as forumid, f.title, p.poster, p.subject, p.body, COUNT(p2.*), t.closed 'SELECT f."group", f.id as forumid, f.title, g.name as groupname, p.poster, p.subject, p.body, COUNT(p2.*), t.closed
FROM {interaction_forum_topic} t FROM {interaction_forum_topic} t
INNER JOIN {interaction_instance} f INNER JOIN {interaction_instance} f ON (f.id = t.forum AND f.deleted != 1)
ON f.id = t.forum INNER JOIN {group} g ON g.id = f.group
AND f.deleted != 1 INNER JOIN {interaction_forum_post} p ON (p.topic = t.id AND p.parent IS NULL)
INNER JOIN {interaction_forum_post} p INNER JOIN {interaction_forum_post} p2 ON (p.poster = p2.poster AND p2.deleted != 1)
ON p.topic = t.id INNER JOIN {interaction_forum_topic} t2 ON (t2.deleted != 1 AND p2.topic = t2.id)
AND p.parent IS NULL INNER JOIN {interaction_instance} f2 ON (t2.forum = f2.id AND f2.deleted != 1 AND f2.group = f.group)
INNER JOIN {interaction_forum_post} p2
ON p.poster = p2.poster
AND p2.deleted != 1
INNER JOIN {interaction_forum_topic} t2
ON t2.deleted != 1
AND p2.topic = t2.id
INNER JOIN {interaction_instance} f2
ON t2.forum = f2.id
AND f2.deleted != 1
AND f2.group = f.group
WHERE t.id = ? WHERE t.id = ?
AND t.deleted != 1 AND t.deleted != 1
GROUP BY 1, 2, 3, 4, 5, 6, 8', GROUP BY 1, 2, 3, 4, 5, 6, 7, 9',
array($topicid) array($topicid)
); );
...@@ -73,23 +63,25 @@ if (!$moderator) { ...@@ -73,23 +63,25 @@ if (!$moderator) {
define('TITLE', get_string('deletetopicvariable', 'interaction.forum', $topic->subject)); define('TITLE', get_string('deletetopicvariable', 'interaction.forum', $topic->subject));
$breadcrumbs = array( $breadcrumbs = array(
array(
get_config('wwwroot') . 'group/view.php?id=' . $topic->group,
$topic->groupname,
),
array( array(
get_config('wwwroot') . 'interaction/forum/index.php?group=' . $topic->group, get_config('wwwroot') . 'interaction/forum/index.php?group=' . $topic->group,
get_string('nameplural', 'interaction.forum') get_string('nameplural', 'interaction.forum')
), ),
array( array(
array( get_config('wwwroot') . 'interaction/forum/view.php?id=' . $topic->forumid,
get_config('wwwroot') . 'interaction/forum/view.php?id=' . $topic->forumid, $topic->title
$topic->title ),
), array(
array( get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topicid,
get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topicid, $topic->subject
$topic->subject ),
), array(
array( get_config('wwwroot') . 'interaction/forum/deletetopic.php?id=' . $topicid,
get_config('wwwroot') . 'interaction/forum/deletetopic.php?id=' . $topicid, get_string('deletetopic', 'interaction.forum')
get_string('deletetopic', 'interaction.forum')
)
) )
); );
...@@ -116,12 +108,12 @@ function deletepost_submit(Pieform $form, $values) { ...@@ -116,12 +108,12 @@ function deletepost_submit(Pieform $form, $values) {
array('deleted' => 1), array('deleted' => 1),
array('id' => $topicid) array('id' => $topicid)
); );
$forumid = get_record_sql( $forumid = get_field_sql(
'SELECT forum 'SELECT forum
FROM interaction_forum_topic FROM interaction_forum_topic
WHERE id = ?', WHERE id = ?',
array($topicid) array($topicid)
)->forum; );
redirect('/interaction/forum/view.php?id=' . $forumid); redirect('/interaction/forum/view.php?id=' . $forumid);
} }
......
...@@ -40,17 +40,12 @@ if ($postid==0) { ...@@ -40,17 +40,12 @@ if ($postid==0) {
define('TITLE', get_string('postreply','interaction.forum')); define('TITLE', get_string('postreply','interaction.forum'));
$parentid = param_integer('parent'); $parentid = param_integer('parent');
$topic = get_record_sql( $topic = get_record_sql(
'SELECT p.topic AS id, p2.subject, t.closed, f.id AS forum, f.title AS forumtitle, f.group 'SELECT p.topic AS id, p2.subject, t.closed, f.id AS forum, f.title AS forumtitle, f.group, g.name AS groupname
FROM {interaction_forum_post} p FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t INNER JOIN {interaction_forum_topic} t ON (p.topic = t.id AND t.deleted != 1)
ON p.topic = t.id INNER JOIN {interaction_forum_post} p2 ON (p2.topic = t.id AND p2.parent IS NULL)
AND t.deleted != 1 INNER JOIN {interaction_instance} f ON (t.forum = f.id AND f.deleted != 1)
INNER JOIN {interaction_forum_post} p2 INNER JOIN {group} g ON g.id = f.group
ON p2.topic = t.id
AND p2.parent IS NULL
INNER JOIN {interaction_instance} f
ON t.forum = f.id
AND f.deleted != 1
WHERE p.id = ? WHERE p.id = ?
AND p.deleted != 1', AND p.deleted != 1',
array($parentid) array($parentid)
...@@ -74,23 +69,25 @@ if ($postid==0) { ...@@ -74,23 +69,25 @@ if ($postid==0) {
$topicsubject = $topic->subject; $topicsubject = $topic->subject;
$breadcrumbs = array( $breadcrumbs = array(
array(
get_config('wwwroot') . 'group/view.php?id=' . $topic->group,
$topic->groupname
),
array( array(
get_config('wwwroot') . 'interaction/forum/index.php?group=' . $topic->group, get_config('wwwroot') . 'interaction/forum/index.php?group=' . $topic->group,
get_string('nameplural', 'interaction.forum') get_string('nameplural', 'interaction.forum')
), ),
array( array(
array( get_config('wwwroot') . 'interaction/forum/view.php?id=' . $topic->forum,
get_config('wwwroot') . 'interaction/forum/view.php?id=' . $topic->forum, $topic->forumtitle
$topic->forumtitle ),
), array(
array( get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topicid,
get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topicid, $topic->subject
$topic->subject ),
), array(
array( get_config('wwwroot') . 'interaction/forum/editpost.php?parent=' . $parentid,
get_config('wwwroot') . 'interaction/forum/editpost.php?parent=' . $parentid, get_string('postreply', 'interaction.forum')
get_string('postreply', 'interaction.forum')
)
) )
); );
} }
...@@ -98,17 +95,12 @@ if ($postid==0) { ...@@ -98,17 +95,12 @@ if ($postid==0) {
if (isset($postid)) { if (isset($postid)) {
define('TITLE', get_string('editpost','interaction.forum')); define('TITLE', get_string('editpost','interaction.forum'));
$post = get_record_sql( $post = get_record_sql(
'SELECT p.subject, p.body, p.parent, p.topic, p.poster, p.ctime, t.forum, p2.subject AS topicsubject, f.title AS forumtitle, f.group 'SELECT p.subject, p.body, p.parent, p.topic, p.poster, p.ctime, t.forum, p2.subject AS topicsubject, f.title AS forumtitle, f.group, g.name AS groupname
FROM {interaction_forum_post} p FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t INNER JOIN {interaction_forum_topic} t ON (p.topic = t.id AND t.deleted != 1)
ON p.topic = t.id INNER JOIN {interaction_forum_post} p2 ON (p2.topic = t.id AND p2.parent IS NULL)
AND t.deleted != 1 INNER JOIN {interaction_instance} f ON (t.forum = f.id AND f.deleted != 1)
INNER JOIN {interaction_forum_post} p2 INNER JOIN {group} g ON g.id = f.group
ON p2.topic = t.id
AND p2.parent IS NULL
INNER JOIN {interaction_instance} f
ON t.forum = f.id
AND f.deleted != 1
WHERE p.id = ? WHERE p.id = ?
AND p.deleted != 1', AND p.deleted != 1',
array($postid) array($postid)
...@@ -134,23 +126,25 @@ if (isset($postid)) { ...@@ -134,23 +126,25 @@ if (isset($postid)) {
} }
$breadcrumbs = array( $breadcrumbs = array(
array(
get_config('wwwroot') . 'group/view.php?id=' . $post->group,
$post->groupname
),
array( array(
get_config('wwwroot') . 'interaction/forum/index.php?group=' . $post->group, get_config('wwwroot') . 'interaction/forum/index.php?group=' . $post->group,
get_string('nameplural', 'interaction.forum') get_string('nameplural', 'interaction.forum')
), ),
array( array(
array( get_config('wwwroot') . 'interaction/forum/view.php?id=' . $post->forum,
get_config('wwwroot') . 'interaction/forum/view.php?id=' . $post->forum, $post->forumtitle
$post->forumtitle ),
), array(
array( get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topicid,
get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topicid, $topicsubject
$topicsubject ),
), array(
array( get_config('wwwroot') . 'interaction/forum/editpost.php?id=' . $postid,
get_config('wwwroot') . 'interaction/forum/editpost.php?id=' . $postid, get_string('editpost', 'interaction.forum')
get_string('editpost', 'interaction.forum')
)
) )
); );
} }
......
...@@ -38,10 +38,11 @@ if ($topicid==0) { ...@@ -38,10 +38,11 @@ if ($topicid==0) {
define('TITLE', get_string('addtopic','interaction.forum')); define('TITLE', get_string('addtopic','interaction.forum'));
$forumid = param_integer('forum'); $forumid = param_integer('forum');
$forum = get_record_sql( $forum = get_record_sql(
'SELECT f.group AS group, f.title 'SELECT f.group AS group, f.title, g.name as groupname
FROM {interaction_instance} f FROM {interaction_instance} f
WHERE id = ? INNER JOIN {group} g ON g.id = f.group
AND deleted != 1', WHERE f.id = ?
AND f.deleted != 1',
array($forumid) array($forumid)
); );
...@@ -61,19 +62,21 @@ if ($topicid==0) { ...@@ -61,19 +62,21 @@ if ($topicid==0) {
} }
$breadcrumbs = array( $breadcrumbs = array(
array(
get_config('wwwroot') . 'group/view.php?id=' . $forum->group,
$forum->groupname
),
array( array(
get_config('wwwroot') . 'interaction/forum/index.php?group=' . $forum->group, get_config('wwwroot') . 'interaction/forum/index.php?group=' . $forum->group,
get_string('nameplural', 'interaction.forum') get_string('nameplural', 'interaction.forum')
), ),
array( array(
array( get_config('wwwroot') . 'interaction/forum/view.php?id=' . $forumid,
get_config('wwwroot') . 'interaction/forum/view.php?id=' . $forumid, $forum->title
$forum->title ),
), array(
array( get_config('wwwroot') . 'interaction/forum/edittopic.php?forum=' . $forumid,
get_config('wwwroot') . 'interaction/forum/edittopic.php?forum=' . $forumid, get_string('addtopic', 'interaction.forum')
get_string('addtopic', 'interaction.forum')
)
) )
); );
} }
...@@ -81,14 +84,11 @@ if ($topicid==0) { ...@@ -81,14 +84,11 @@ if ($topicid==0) {
if (isset($topicid)) { if (isset($topicid)) {
define('TITLE', get_string('edittopic','interaction.forum')); define('TITLE', get_string('edittopic','interaction.forum'));
$topic = get_record_sql( $topic = get_record_sql(
'SELECT p.subject, p.body, p.topic AS id, t.sticky, t.closed, f.id as forumid, f.group as group, f.title 'SELECT p.subject, p.body, p.topic AS id, t.sticky, t.closed, f.id as forumid, f.group AS group, f.title, g.name AS groupname
FROM {interaction_forum_post} p FROM {interaction_forum_post} p
INNER JOIN {interaction_forum_topic} t INNER JOIN {interaction_forum_topic} t ON (p.topic = t.id AND t.deleted != 1)
ON p.topic = t.id INNER JOIN {interaction_instance} f ON (f.id = t.forum AND f.deleted != 1)
AND t.deleted != 1 INNER JOIN {group} g ON g.id = f.group
INNER JOIN {interaction_instance} f
ON f.id = t.forum
AND f.deleted != 1
WHERE p.parent IS NULL WHERE p.parent IS NULL
AND p.topic = ?', AND p.topic = ?',
array($topicid) array($topicid)
...@@ -112,23 +112,25 @@ if (isset($topicid)) { ...@@ -112,23 +112,25 @@ if (isset($topicid)) {
} }
$breadcrumbs = array( $breadcrumbs = array(
array(
get_config('wwwroot') . 'group/view.php?id=' . $topic->group,
$topic->groupname
),
array( array(
get_config('wwwroot') . 'interaction/forum/index.php?group=' . $topic->group, get_config('wwwroot') . 'interaction/forum/index.php?group=' . $topic->group,
get_string('nameplural', 'interaction.forum') get_string('nameplural', 'interaction.forum')
), ),
array( array(
array( get_config('wwwroot') . 'interaction/forum/view.php?id=' . $topic->forumid,
get_config('wwwroot') . 'interaction/forum/view.php?id=' . $topic->forumid, $topic->title
$topic->title ),
), array(
array( get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topicid,
get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topicid, $topic->subject
$topic->subject ),
), array(
array( get_config('wwwroot') . 'interaction/forum/edittopic.php?id=' . $topicid,
get_config('wwwroot') . 'interaction/forum/edittopic.php?id=' . $topicid, get_string('edittopic', 'interaction.forum')
get_string('edittopic', 'interaction.forum')
)
) )
); );
......
<?php <?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 interaction-forum
* @author Clare Lenihan <clare@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
$string['addtitle'] = 'Add forum'; $string['addtitle'] = 'Add forum';
$string['addtopic'] = 'Add topic'; $string['addtopic'] = 'Add topic';
$string['body'] = 'Body'; $string['body'] = 'Body';
...@@ -18,6 +43,7 @@ $string['closed'] = 'Closed'; ...@@ -18,6 +43,7 @@ $string['closed'] = 'Closed';
$string['count'] = 'Count'; $string['count'] = 'Count';
$string['currentmoderators'] = 'Current Moderators'; $string['currentmoderators'] = 'Current Moderators';
$string['delete'] = 'Delete'; $string['delete'] = 'Delete';
$string['deleteforum'] = 'Delete forum';
$string['deletedpost'] = 'This post has been deleted'; $string['deletedpost'] = 'This post has been deleted';
$string['deletepost'] = 'Delete post'; $string['deletepost'] = 'Delete post';
$string['deletepostvariable'] = 'Delete post \'%s\''; $string['deletepostvariable'] = 'Delete post \'%s\'';
...@@ -32,6 +58,7 @@ $string['edittopic'] = 'Edit topic'; ...@@ -32,6 +58,7 @@ $string['edittopic'] = 'Edit topic';
$string['forumsuccessfulsubscribe'] = 'Forum subscribed successfully'; $string['forumsuccessfulsubscribe'] = 'Forum subscribed successfully';
$string['forumsuccessfulunsubscribe'] = 'Forum unsubscribed successfully'; $string['forumsuccessfulunsubscribe'] = 'Forum unsubscribed successfully';
$string['moderators'] = 'Moderators'; $string['moderators'] = 'Moderators';
$string['moderatorsdescription'] = 'Moderators can edit and delete topics and posts. They can also open, close, set and unset topics as sticky';
$string['name'] = 'Forum'; $string['name'] = 'Forum';
$string['nameplural'] = 'Forums'; $string['nameplural'] = 'Forums';
$string['newforum'] = 'New forum'; $string['newforum'] = 'New forum';
...@@ -45,7 +72,8 @@ $string['post'] = 'Post'; ...@@ -45,7 +72,8 @@ $string['post'] = 'Post';
$string['postedin'] = '%s posted in %s'; $string['postedin'] = '%s posted in %s';
$string['poster'] = 'Poster'; $string['poster'] = 'Poster';
$string['postreply'] = 'Post reply'; $string['postreply'] = 'Post reply';
$string['posts'] = 'Posts: %s'; $string['posts'] = 'Posts';
$string['postsvariable'] = 'Posts: %s';
$string['potentialmoderators'] = 'Potential Moderators'; $string['potentialmoderators'] = 'Potential Moderators';
$string['re'] ='Re: %s'; $string['re'] ='Re: %s';
$string['regulartopics'] = 'Regular topics'; $string['regulartopics'] = 'Regular topics';
...@@ -55,9 +83,16 @@ $string['stickytopics'] = 'Sticky topics'; ...@@ -55,9 +83,16 @@ $string['stickytopics'] = 'Sticky topics';
$string['subscribe'] = 'Subscribe'; $string['subscribe'] = 'Subscribe';
$string['subject'] = 'Subject'; $string['subject'] = 'Subject';
$string['topic'] = 'Topic'; $string['topic'] = 'Topic';
$string['topiclower'] = 'topic';
$string['topics'] = 'Topics: %s'; $string['topics'] = 'Topics: %s';
$string['topicslower'] = 'topics';
$string['topicclosedsuccess'] = 'Topics were closed successfully';
$string['topicstickysuccess'] = 'Topics were set as sticky successfully';
$string['topicsubscribesuccess'] = 'Topics subscribed successfully';
$string['topicupdatefailed'] = 'Topics update failed';
$string['typenewpost'] = 'New post'; $string['typenewpost'] = 'New post';
$string['unsubscribe'] = 'Unsubscribe'; $string['unsubscribe'] = 'Unsubscribe';
$string['weight'] = 'Weight'; $string['weight'] = 'Weight';
$string['weightdescription'] = 'The weight controls the order of forums. Forums with lower weights appear above forums with higher weights';
?> ?>
...@@ -138,14 +138,8 @@ class PluginInteractionForum extends PluginInteraction { ...@@ -138,14 +138,8 @@ class PluginInteractionForum extends PluginInteraction {
'forum' 'forum'
); );
} }
execute_sql( set_field_select('interaction_forum_post', 'sent', 1,
'UPDATE {interaction_forum_post} 'ctime < ? AND deleted = 0 AND sent = 0', array(db_format_timestamp($currenttime - 30 * 60)));
SET sent = 1
WHERE ctime < ?
AND deleted != 1
AND sent = 0',
array(db_format_timestamp($currenttime - 30 * 60))
);
} }
} }
} }
......
...@@ -3,20 +3,14 @@ ...@@ -3,20 +3,14 @@
{include file="columnleftstart.tpl"} {include file="columnleftstart.tpl"}
<p> <h2>{$topicsubject|escape} - {$heading|escape}</h2>
<a href="{$breadcrumbs[0][0]|escape}">{$breadcrumbs[0][1]|escape}</a>
{foreach from=$breadcrumbs[1] item=item}
&raquo <a href="{$item[0]|escape}">{$item[1]|escape}</a>
{/foreach}
</p>
<h2>{$topicsubject|escape}</h2>