Commit 68ce2190 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan

changing single work language strings to be capitalised

changing subscribe to foum redirect to be safe
fix short topic bodies so they stop at first linebreak and work correctly for html entities
parent 9249d9c4
......@@ -206,7 +206,7 @@ $editform = pieform(array(
'elements' => array(
'subject' => array(
'type' => 'text',
'title' => get_string('subject', 'interaction.forum'),
'title' => get_string('Subject', 'interaction.forum'),
'defaultvalue' => isset($post) ? $post->subject : null,
'rules' => array(
'maxlength' => 255,
......@@ -215,7 +215,7 @@ $editform = pieform(array(
),
'body' => array(
'type' => 'wysiwyg',
'title' => get_string('body', 'interaction.forum'),
'title' => get_string('Body', 'interaction.forum'),
'rows' => 10,
'cols' => 70,
'defaultvalue' => isset($post) ? $post->body : null,
......@@ -224,7 +224,7 @@ $editform = pieform(array(
'submit' => array(
'type' => 'submitcancel',
'value' => array(
isset($post) ? get_string('edit') : get_string('post','interaction.forum'),
isset($post) ? get_string('edit') : get_string('Post','interaction.forum'),
get_string('cancel')
),
'goto' => get_config('wwwroot') . 'interaction/forum/topic.php?id='.$topicid
......
......@@ -153,7 +153,7 @@ $editform = array(
'elements' => array(
'subject' => array(
'type' => 'text',
'title' => get_string('subject', 'interaction.forum'),
'title' => get_string('Subject', 'interaction.forum'),
'defaultvalue' => isset($topic) ? $topic->subject : null,
'rules' => array(
'required' => true,
......@@ -162,7 +162,7 @@ $editform = array(
),
'body' => array(
'type' => 'wysiwyg',
'title' => get_string('body', 'interaction.forum'),
'title' => get_string('Body', 'interaction.forum'),
'rows' => 10,
'cols' => 70,
'defaultvalue' => isset($topic) ? $topic->body : null,
......@@ -170,20 +170,20 @@ $editform = array(
),
'sticky' => array(
'type' => 'checkbox',
'title' => get_string('sticky', 'interaction.forum'),
'title' => get_string('Sticky', 'interaction.forum'),
'description' => get_string('stickydescription', 'interaction.forum'),
'defaultvalue' => isset($topic) && $topic->sticky == 1 ? 'checked' : null
),
'closed' => array(
'type' => 'checkbox',
'title' => get_string('closed', 'interaction.forum'),
'title' => get_string('Closed', 'interaction.forum'),
'description' => get_string('closeddescription', 'interaction.forum'),
'defaultvalue' => isset($topic) && $topic->closed == 1 ? 'checked' : null
),
'submit' => array(
'type' => 'submitcancel',
'value' => array(
isset($topic) ? get_string('edit') : get_string('post','interaction.forum'),
isset($topic) ? get_string('edit') : get_string('Post','interaction.forum'),
get_string('cancel')
),
'goto' => get_config('wwwroot') . 'interaction/forum/' . (isset($topic) && $returnto != 'view' ? 'topic.php?id='.$topicid : 'view.php?id='.$forumid)
......
......@@ -103,7 +103,7 @@ if ($forums) {
'elements' => array(
'submit' => array(
'type' => 'submit',
'value' => $forum->subscribed ? get_string('unsubscribe', 'interaction.forum') : get_string('subscribe', 'interaction.forum')
'value' => $forum->subscribed ? get_string('Unsubscribe', 'interaction.forum') : get_string('Subscribe', 'interaction.forum')
),
'forum' => array(
'type' => 'hidden',
......@@ -111,7 +111,11 @@ if ($forums) {
),
'redirect' => array(
'type' => 'hidden',
'value' => '/interaction/forum/index.php?group=' . $groupid
'value' => 'index'
),
'group' => array(
'type' => 'hidden',
'value' => $groupid
),
'type' => array(
'type' => 'hidden',
......
......@@ -28,7 +28,7 @@ $string['addpostsuccess'] = 'Added post successfully';
$string['addtitle'] = 'Add forum';
$string['addtopic'] = 'Add topic';
$string['addtopicsuccess'] = 'Added topic successfully';
$string['body'] = 'Body';
$string['Body'] = 'Body';
$string['cantaddposttoforum'] = 'You are not allowed to post in this forum';
$string['cantaddposttotopic'] = 'You are not allowed to post in this topic';
$string['cantaddtopic'] = 'You are not allowed to add topics to this forum';
......@@ -44,11 +44,10 @@ $string['cantviewforums'] = 'You are not allowed to view forums in this group';
$string['cantviewtopic'] = 'You are not allowed to view topics in this forum';
$string['chooseanaction'] = 'Choose an action';
$string['clicksetsubject'] = 'Click to set a subject';
$string['closed'] = 'Closed';
$string['Closed'] = 'Closed';
$string['closeddescription'] = 'Closed topics can only be replied to by moderators and the group owner';
$string['count'] = 'Count';
$string['Count'] = 'Count';
$string['currentmoderators'] = 'Current Moderators';
$string['delete'] = 'Delete';
$string['deleteforum'] = 'Delete forum';
$string['deletedpost'] = 'This post has been deleted';
$string['deletepost'] = 'Delete post';
......@@ -58,7 +57,6 @@ $string['deletetopic'] = 'Delete topic';
$string['deletetopicvariable'] = 'Delete topic \'%s\'';
$string['deletetopicsuccess'] = 'Topic deleted successfully';
$string['deletetopicsure'] = 'Are you sure you want to do this? It cannot be undone.';
$string['editedon'] = '%s on %s';
$string['editpost'] = 'Edit post';
$string['editpostsuccess'] = 'Post edited successfully';
$string['editstothispost'] = 'Edits to this post:';
......@@ -67,9 +65,11 @@ $string['edittopic'] = 'Edit topic';
$string['edittopicsuccess'] = 'Topic edited successfully';
$string['forumsuccessfulsubscribe'] = 'Forum subscribed successfully';
$string['forumsuccessfulunsubscribe'] = 'Forum unsubscribed successfully';
$string['groupowner'] = 'Group owner';
$string['groupownerlist'] = 'Group owner:';
$string['lastpost'] = 'Last post';
$string['lastposton'] = '%s on %s';
$string['moderators'] = 'Moderators';
$string['Moderators'] = 'Moderators';
$string['moderatorslist'] = '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['nameplural'] = 'Forums';
......@@ -79,29 +79,29 @@ $string['newpost'] = 'New post: ';
$string['newtopic'] = 'New topic';
$string['noforums'] = 'There are no forums in this group';
$string['notopics'] = 'There are no topics in this forum';
$string['open'] = 'Open';
$string['order'] = 'Order';
$string['Open'] = 'Open';
$string['Order'] = 'Order';
$string['orderdescription'] = 'Choose where you want the forum to be ordered compared to the other forums';
$string['post'] = 'Post';
$string['Post'] = 'Post';
$string['postedin'] = '%s posted in %s';
$string['poster'] = 'Poster';
$string['Poster'] = 'Poster';
$string['postreply'] = 'Post reply';
$string['posts'] = 'Posts';
$string['Posts'] = 'Posts';
$string['postsvariable'] = 'Posts: %s';
$string['potentialmoderators'] = 'Potential Moderators';
$string['re'] ='Re: %s';
$string['regulartopics'] = 'Regular topics';
$string['reply'] = 'Reply';
$string['Reply'] = 'Reply';
$string['replyto'] = 'Reply to: ';
$string['sticky'] = 'Sticky';
$string['Sticky'] = 'Sticky';
$string['stickydescription'] = 'Sticky topics are at the top of every page';
$string['stickytopics'] = 'Sticky topics';
$string['subscribe'] = 'Subscribe';
$string['Subscribe'] = 'Subscribe';
$string['Subscribed'] = 'Subscribed';
$string['subscribetoforum'] = 'Subscribe to forum';
$string['subscribetotopic'] = 'Subscribe to topic';
$string['subject'] = 'Subject';
$string['topic'] = 'Topic';
$string['Subject'] = 'Subject';
$string['Topic'] = 'Topic';
$string['topiclower'] = 'topic';
$string['topics'] = 'Topics: %s';
$string['topicslower'] = 'topics';
......@@ -114,8 +114,8 @@ $string['topicunstickysuccess'] = 'Topic unset as sticky successfully';
$string['topicunsubscribesuccess'] = 'Topics unsubscribed successfully';
$string['topicupdatefailed'] = 'Topics update failed';
$string['typenewpost'] = 'New post';
$string['unsticky'] = 'Unsticky';
$string['unsubscribe'] = 'Unsubscribe';
$string['Unsticky'] = 'Unsticky';
$string['Unsubscribe'] = 'Unsubscribe';
$string['unsubscribefromforum'] = 'Unsubscribe from forum';
$string['unsubscribefromtopic'] = 'Unsubscribe from topic';
$string['updateselectedtopics'] = 'Update selected topics';
......
......@@ -66,7 +66,7 @@ class PluginInteractionForum extends PluginInteraction {
'elements' => array(
'weight' => array(
'type' => 'weight',
'title' => get_string('order', 'interaction.forum'),
'title' => get_string('Order', 'interaction.forum'),
'description' => get_string('orderdescription', 'interaction.forum'),
'defaultvalue' => isset($weight) ? $weight : count($existing),
'rules' => array(
......@@ -77,7 +77,7 @@ class PluginInteractionForum extends PluginInteraction {
),
'moderator' => array(
'type' => 'userlist',
'title' => get_string('moderators', 'interaction.forum'),
'title' => get_string('Moderators', 'interaction.forum'),
'description' => get_string('moderatorsdescription', 'interaction.forum'),
'defaultvalue' => isset($moderators) ? $moderators : null,
'group' => $group->id,
......@@ -380,7 +380,12 @@ function subscribe_forum_submit(Pieform $form, $values) {
);
$SESSION->add_ok_msg(get_string('forumsuccessfulunsubscribe', 'interaction.forum'));
}
redirect($values['redirect']);
if ($values['redirect'] == 'index') {
redirect('/interaction/forum/index.php?group=' . $values['group']);
}
else {
redirect('/interaction/forum/view.php?id=' . $values['forum'] . '&offset=' . $values['offset']);
}
}
?>
......@@ -7,7 +7,7 @@
{include file="interaction:forum:simplepost.tpl" post=$post groupowner=$groupowner nosubject=true}
{/if}
<div>
{if $moderator || !$closed}<a href="{$WWWROOT}interaction/forum/editpost.php?parent={$post->id|escape}">{str tag="reply" section=interaction.forum}</a>{/if}
{if $moderator || !$closed}<a href="{$WWWROOT}interaction/forum/editpost.php?parent={$post->id|escape}">{str tag="Reply" section=interaction.forum}</a>{/if}
{if ($moderator || !$closed) && $post->canedit} | {/if}
{if $post->canedit}<a href="{$WWWROOT}interaction/forum/editpost.php?id={$post->id|escape}"> {str tag="edit"}</a>{/if}
{if $moderator && $post->parent} | <a href="{$WWWROOT}interaction/forum/deletepost.php?id={$post->id|escape}"> {str tag="delete"}</a>{/if}
......
......@@ -5,8 +5,8 @@
<tr class="r0">
{/if}
<td>
{if $topic->closed}<img src="{$closedicon|escape}" alt="{str tag="closed" section="interaction.forum"}">{/if}
{if $topic->subscribed}<img src="{$subscribedicon|escape}" alt="{str tag="subscribed" section="interaction.forum"}">{/if}
{if $topic->closed}<img src="{$closedicon|escape}" alt="{str tag="Closed" section="interaction.forum"}">{/if}
{if $topic->subscribed}<img src="{$subscribedicon|escape}" alt="{str tag="Subscribed" section="interaction.forum"}">{/if}
</td>
{if !$forum->subscribed || $moderator}
<td>
......
......@@ -39,14 +39,14 @@
<select name="type1">
<option value="default" selected="selected">{str tag="chooseanaction" section="interaction.forum"}</option>
{if !$forum->subscribed}
<option value="subscribe">{str tag="subscribe" section="interaction.forum"}</option>
<option value="unsubscribe">{str tag="unsubscribe" section="interaction.forum"}</option>
<option value="subscribe">{str tag="Subscribe" section="interaction.forum"}</option>
<option value="unsubscribe">{str tag="Unsubscribe" section="interaction.forum"}</option>
{/if}
{if $moderator}
<option value="sticky">{str tag="sticky" section="interaction.forum"}</option>
<option value="unsticky">{str tag="unsticky" section="interaction.forum"}</option>
<option value="closed">{str tag="closed" section="interaction.forum"}</option>
<option value="open">{str tag="open" section="interaction.forum"}</option>
<option value="sticky">{str tag="Sticky" section="interaction.forum"}</option>
<option value="unsticky">{str tag="Unsticky" section="interaction.forum"}</option>
<option value="closed">{str tag="Closed" section="interaction.forum"}</option>
<option value="open">{str tag="Open" section="interaction.forum"}</option>
{/if}
</select>
<input type="submit" name="updatetopics1" value="{str tag="updateselectedtopics" section="interaction.forum"}" class="submit">
......@@ -55,9 +55,9 @@
<tr>
<th></th>
{if !$forum->subscribed || $moderator}<th></th>{/if}
<th>{str tag="topic" section="interaction.forum"}</th>
<th>{str tag="poster" section="interaction.forum"}</th>
<th>{str tag="posts" section="interaction.forum"}</th>
<th>{str tag="Topic" section="interaction.forum"}</th>
<th>{str tag="Poster" section="interaction.forum"}</th>
<th>{str tag="Posts" section="interaction.forum"}</th>
<th>{str tag="lastpost" section="interaction.forum"}</th>
{if $moderator}<th></th>{/if}
</tr>
......@@ -76,14 +76,14 @@
<select name="type2">
<option value="default" selected="selected">{str tag="chooseanaction" section="interaction.forum"}</option>
{if !$forum->subscribed}
<option value="subscribe">{str tag="subscribe" section="interaction.forum"}</option>
<option value="unsubscribe">{str tag="unsubscribe" section="interaction.forum"}</option>
<option value="subscribe">{str tag="Subscribe" section="interaction.forum"}</option>
<option value="unsubscribe">{str tag="Unsubscribe" section="interaction.forum"}</option>
{/if}
{if $moderator}
<option value="sticky">{str tag="sticky" section="interaction.forum"}</option>
<option value="unsticky">{str tag="unsticky" section="interaction.forum"}</option>
<option value="closed">{str tag="closed" section="interaction.forum"}</option>
<option value="open">{str tag="open" section="interaction.forum"}</option>
<option value="sticky">{str tag="Sticky" section="interaction.forum"}</option>
<option value="unsticky">{str tag="Unsticky" section="interaction.forum"}</option>
<option value="closed">{str tag="Closed" section="interaction.forum"}</option>
<option value="open">{str tag="Open" section="interaction.forum"}</option>
{/if}
</select>
<input type="submit" name="updatetopics2" value="{str tag="updateselectedtopics" section="interaction.forum"}" class="submit">
......@@ -92,10 +92,10 @@
<h4>Key:</h4>
<ul>
<li><img src="{$closedicon|escape}" alt="{str tag="closed" section="interaction.forum"}"> {str tag="closed" section="interaction.forum"}</li>
<li><img src="{$closedicon|escape}" alt="{str tag="Closed" section="interaction.forum"}"> {str tag="Closed" section="interaction.forum"}</li>
<li><img src="{$subscribedicon|escape}" alt="{str tag="Subscribed" section="interaction.forum"}"> {str tag="Subscribed" section="interaction.forum"}</li>
<li><span class="groupowner">{str tag="groupowner" section="interaction.forum"}</span></li>
<li><span class="moderator">{str tag="moderators" section="interaction.forum"}</span></li>
<li><span class="moderator">{str tag="Moderators" section="interaction.forum"}</span></li>
</ul>
{else}
......
......@@ -106,7 +106,7 @@ if (!$topic->forumsubscribed) {
}
$posts = get_records_sql_array(
'SELECT p1.id, p1.parent, p1.poster, p1.subject, p1.id, ' . db_format_tsfield('p1.ctime', 'ctime') . ', p1.deleted, m.user AS moderator, COUNT(p2.*), ' . db_format_tsfield('e.ctime', 'edittime') . ', e.user AS editor, m2.user as editormoderator
'SELECT p1.id, p1.parent, p1.poster, p1.subject, p1.body, ' . db_format_tsfield('p1.ctime', 'ctime') . ', p1.deleted, m.user AS moderator, COUNT(p2.*), ' . db_format_tsfield('e.ctime', 'edittime') . ', e.user AS editor, m2.user as editormoderator
FROM {interaction_forum_post} p1
INNER JOIN {interaction_forum_topic} t ON (t.id = p1.topic)
INNER JOIN {interaction_forum_post} p2 ON (p1.poster = p2.poster AND p2.deleted != 1)
......
......@@ -155,7 +155,11 @@ $forum->subscribe = pieform(array(
),
'redirect' => array(
'type' => 'hidden',
'value' => '/interaction/forum/view.php?id=' . $forumid . '&amp;offset=' . $offset
'value' => 'view'
),
'offset' => array(
'type' => 'hidden',
'value' => $offset
),
'type' => array(
'type' => 'hidden',
......@@ -249,24 +253,35 @@ $smarty->display('interaction:forum:view.tpl');
function setup_topics(&$topics) {
if ($topics) {
foreach ($topics as $topic) {
if ($topic->deleted) {
$topic->body = '';
$more = false;
$nextbreak = strpos($topic->body, '<p', 1);
if ($nextbreak !== false) {
$topic->body = substr($topic->body, 0, $nextbreak);
$more = true;
}
else {
$topic->body = strip_tags($topic->body);
// take the first 50 chars, then up to the first space (max length 60 chars)
if (strlen($topic->body) > 60) {
$topic->body = substr($topic->body, 0, 60);
$nextspace = strpos($topic->body, ' ', 50);
if ($nextspace !== false) {
$topic->body = substr($topic->body, 0, $nextspace);
}
$topic->body .= '...';
$nextbreak = strpos($topic->body, '<br', 1);
if ($nextbreak !== false) {
$topic->body = substr($topic->body, 0, $nextbreak);
$more = true;
}
$topic->body = strip_tags($topic->body);
$topic->body = html_entity_decode($topic->body);
// take the first 50 chars, then up to the first space (max length 60 chars)
if (strlen($topic->body) > 60) {
$topic->body = substr($topic->body, 0, 60);
$nextspace = strpos($topic->body, ' ', 50);
if ($nextspace !== false) {
$topic->body = substr($topic->body, 0, $nextspace);
}
$more = true;
}
if (!$topic->lastpostdeleted) {
$topic->lastposttime = strftime(get_string('strftimerecent'), $topic->lastposttime);
if ($more) {
$topic->body .= '...';
}
$topic->body = htmlentities($topic->body);
}
if (!$topic->lastpostdeleted) {
$topic->lastposttime = strftime(get_string('strftimerecent'), $topic->lastposttime);
}
}
}
......
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