Commit aeab55c2 authored by Ruslan Kabalin's avatar Ruslan Kabalin

forum: notify user how much time left to complete editing (bug #731990)

Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent c69d4806
......@@ -103,6 +103,7 @@ else { // edit post
// no record for edits to own posts with 30 minutes
if (user_can_edit_post($post->poster, $post->ctime)) {
$post->editrecord = false;
$timeleft = (int)get_config_plugin('interaction', 'forum', 'postdelay') - round((time() - $post->ctime) / 60);
}
else if ($moderator) {
$post->editrecord = true;
......@@ -241,6 +242,10 @@ $smarty->assign('groupadmins', group_get_admin_ids($parent->group));
if (isset($inlinejs)) {
$smarty->assign('INLINEJAVASCRIPT', $inlinejs);
}
if (isset($timeleft)) {
$smarty->assign('timeleft', $timeleft);
}
$smarty->display('interaction:forum:editpost.tpl');
?>
......@@ -96,6 +96,7 @@ else { // edit topic
// no record for edits to own posts with 30 minutes
if (user_can_edit_post($topic->poster, $topic->ctime)) {
$topic->editrecord = false;
$timeleft = (int)get_config_plugin('interaction', 'forum', 'postdelay') - round((time() - $topic->ctime) / 60);
}
else if ($moderator) {
$topic->editrecord = true;
......@@ -268,6 +269,9 @@ $smarty = smarty();
$smarty->assign('heading', $forum->groupname);
$smarty->assign('subheading', TITLE);
$smarty->assign('editform', $editform);
if (isset($timeleft)) {
$smarty->assign('timeleft', $timeleft);
}
$smarty->display('interaction:forum:edittopic.tpl');
?>
......@@ -180,4 +180,6 @@ $string['maxindentdescription'] = 'Set the maximum indention level for a topic.
$string['closetopics'] = 'Close new topics';
$string['closetopicsdescription'] = 'If checked, all new topics in this forum will be closed by default. Only moderators and group administrators can reply to closed topics.';
$string['activetopicsdescription'] = 'Recently updated topics in your groups.';
\ No newline at end of file
$string['activetopicsdescription'] = 'Recently updated topics in your groups.';
$string['timeleftnotice'] = 'You have %s minutes left to finish editing';
\ No newline at end of file
{include file="header.tpl"}
{if $timeleft}<div class="fr timeleftnotice">{str tag="timeleftnotice" section="interaction.forum" args=$timeleft}</div>{/if}
<h2><a href="{$WWWROOT}interaction/forum/topic.php?id={$parent->topic}">{$parent->topicsubject}</a> - {$action}</h2>
{$editform|safe}
......
{include file="header.tpl"}
{if $timeleft}<div class="fr timeleftnotice">{str tag="timeleftnotice" section="interaction.forum" args=$timeleft}</div>{/if}
<h2>{$subheading}</h2>
{$editform|safe}
{include file="footer.tpl"}
......@@ -195,3 +195,8 @@
padding: 0 0 0 10px;
}
/* Post and topic editing*/
.timeleftnotice {
margin-top: 0.8em;
font-size: .9167em;
}
\ No newline at end of file
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