Commit 3772eb16 authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic
Browse files

Bug 1794189: Fixing edit post/topic time remaining message



Things done:
1) Giving it alert styling
2) Getting the number of minutes to count down so to be less confusing

behatnotneeded

Change-Id: Ic28d2f6b266a011a40f03cf6a4d9474b6007053a
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 11c5bc57
...@@ -100,7 +100,7 @@ else { // edit post ...@@ -100,7 +100,7 @@ else { // edit post
// no record for edits to own posts with 30 minutes // no record for edits to own posts with 30 minutes
if (user_can_edit_post($post->poster, $post->ctime)) { if (user_can_edit_post($post->poster, $post->ctime)) {
$post->editrecord = false; $post->editrecord = false;
$timeleft = (int)get_config_plugin('interaction', 'forum', 'postdelay') - round((time() - $post->ctime) / 60); $timeleft = ceil(get_config_plugin('interaction', 'forum', 'postdelay') - (time() - $post->ctime) / 60);
} }
else if ($moderator) { else if ($moderator) {
$post->editrecord = true; $post->editrecord = true;
...@@ -280,6 +280,7 @@ $smarty = smarty(); ...@@ -280,6 +280,7 @@ $smarty = smarty();
$smarty->assign('deleteduser', $poster->get('deleted')); $smarty->assign('deleteduser', $poster->get('deleted'));
$smarty->assign('poster', $poster); $smarty->assign('poster', $poster);
$smarty->assign('editform', $editform); $smarty->assign('editform', $editform);
$smarty->assign('moderator', $moderator);
$smarty->assign('parent', $parent); $smarty->assign('parent', $parent);
$smarty->assign('action', $action); $smarty->assign('action', $action);
$smarty->assign('groupadmins', group_get_admin_ids($parent->group)); $smarty->assign('groupadmins', group_get_admin_ids($parent->group));
......
...@@ -88,7 +88,7 @@ else { // edit topic ...@@ -88,7 +88,7 @@ else { // edit topic
// no record for edits to own posts with 30 minutes // no record for edits to own posts with 30 minutes
if (user_can_edit_post($topic->poster, $topic->ctime)) { if (user_can_edit_post($topic->poster, $topic->ctime)) {
$topic->editrecord = false; $topic->editrecord = false;
$timeleft = (int)get_config_plugin('interaction', 'forum', 'postdelay') - round((time() - $topic->ctime) / 60); $timeleft = ceil(get_config_plugin('interaction', 'forum', 'postdelay') - (time() - $topic->ctime) / 60);
} }
else if ($moderator) { else if ($moderator) {
$topic->editrecord = true; $topic->editrecord = true;
...@@ -302,6 +302,7 @@ function edittopic_submit(Pieform $form, $values) { ...@@ -302,6 +302,7 @@ function edittopic_submit(Pieform $form, $values) {
$smarty = smarty(); $smarty = smarty();
$smarty->assign('heading', $forum->groupname); $smarty->assign('heading', $forum->groupname);
$smarty->assign('subheading', $topictype); $smarty->assign('subheading', $topictype);
$smarty->assign('moderator', $moderator);
$smarty->assign('editform', $editform); $smarty->assign('editform', $editform);
if (isset($timeleft)) { if (isset($timeleft)) {
$smarty->assign('timeleft', $timeleft); $smarty->assign('timeleft', $timeleft);
......
...@@ -117,7 +117,7 @@ $string['Open'] = 'Open'; ...@@ -117,7 +117,7 @@ $string['Open'] = 'Open';
$string['Order'] = 'Order'; $string['Order'] = 'Order';
$string['orderdescription'] = 'Choose at which position this forum shall appear in the list of forums'; $string['orderdescription'] = 'Choose at which position this forum shall appear in the list of forums';
$string['Post'] = 'Post'; $string['Post'] = 'Post';
$string['postaftertimeout'] = 'You have submitted your change after timeout of %s minutes. Your change has not been applied.'; $string['postaftertimeout'] = 'You have submitted your change after the timeout of %s minutes. Your change has not been applied.';
$string['postbyuserwasdeleted'] = 'A post by %s was deleted'; $string['postbyuserwasdeleted'] = 'A post by %s was deleted';
$string['postsbyuserweredeleted'] = '%s posts by %s were deleted'; $string['postsbyuserweredeleted'] = '%s posts by %s were deleted';
$string['postdelay'] = 'Post delay'; $string['postdelay'] = 'Post delay';
...@@ -203,7 +203,9 @@ $string['closetopicsdescription1'] = 'Close all new topics by default. Only mode ...@@ -203,7 +203,9 @@ $string['closetopicsdescription1'] = 'Close all new topics by default. Only mode
$string['activetopicsdescription'] = 'Recently updated topics in your groups.'; $string['activetopicsdescription'] = 'Recently updated topics in your groups.';
$string['timeleftnotice'] = 'You have %s minutes left to finish editing.'; $string['timeleftnotice1'] = 'You have <span class="num">%s</span> minutes left to finish editing.';
$string['timeleftnoticeexpired'] = 'The edit time is over. Your changes will not be saved.';
$string['timeleftnoticeexpiredmoderator'] = 'Your changes will now be saved with an edit notice.';
$string['objectionablecontentpost'] = 'Objectionable content on forum topic "%s" reported by %s'; $string['objectionablecontentpost'] = 'Objectionable content on forum topic "%s" reported by %s';
$string['objectionablecontentposthtml'] = '<div style="padding: 0.5em 0; border-bottom: 1px solid #999;">Objectionable content on forum topic "%s" reported by %s $string['objectionablecontentposthtml'] = '<div style="padding: 0.5em 0; border-bottom: 1px solid #999;">Objectionable content on forum topic "%s" reported by %s
......
{include file="header.tpl"} {include file="header.tpl"}
{if $timeleft}<div class="fr timeleftnotice">{str tag="timeleftnotice" section="interaction.forum" args=$timeleft}</div>{/if} {if $timeleft}
<div class="alert alert-warning" id="timeleft">{str tag="timeleftnotice1" section="interaction.forum" args=$timeleft}</div>
<div class="timeexpired hidden">{if $moderator}{str tag="timeleftnoticeexpiredmoderator" section="interaction.forum"}{else}{str tag="timeleftnoticeexpired" section="interaction.forum"}{/if}</div>
{/if}
<h2><a href="{$WWWROOT}interaction/forum/topic.php?id={$parent->topic}">{$parent->topicsubject}</a> - {$action}</h2> <h2><a href="{$WWWROOT}interaction/forum/topic.php?id={$parent->topic}">{$parent->topicsubject}</a> - {$action}</h2>
<script type='application/javascript'>
// Set the number we're counting down from
var countfrom = {$timeleft};
// Update the count down every 1 minute
var x = setInterval(function() {
countfrom = countfrom -1;
jQuery('#timeleft .num').html(countfrom);
// If the count down is finished, write some text
if (countfrom <= 0) {
clearInterval(x);
jQuery('#timeleft').html(jQuery('.timeexpired').html());
}
}, 60000);
</script>
{$editform|safe} {$editform|safe}
<div class="replyto"><h4>{str tag="replyto" section="interaction.forum"}</h4> <div class="replyto"><h4>{str tag="replyto" section="interaction.forum"}</h4>
......
{include file="header.tpl"} {include file="header.tpl"}
{if $timeleft}<div class="fr timeleftnotice">{str tag="timeleftnotice" section="interaction.forum" args=$timeleft}</div>{/if} {if $timeleft}
<div class="alert alert-warning" id="timeleft">{str tag="timeleftnotice1" section="interaction.forum" args=$timeleft}</div>
<div class="timeexpired hidden">{if $moderator}{str tag="timeleftnoticeexpiredmoderator" section="interaction.forum"}{else}{str tag="timeleftnoticeexpired" section="interaction.forum"}{/if}</div>
{/if}
<h2>{$subheading}</h2> <h2>{$subheading}</h2>
<script type='application/javascript'>
// Set the number we're counting down from
var countfrom = {$timeleft};
// Update the count down every 1 minute
var x = setInterval(function() {
countfrom = countfrom -1;
jQuery('#timeleft .num').html(countfrom);
// If the count down is finished, write some text
if (countfrom <= 0) {
clearInterval(x);
jQuery('#timeleft').html(jQuery('.timeexpired').html());
}
}, 60000);
</script>
{$editform|safe} {$editform|safe}
{include file="footer.tpl"} {include file="footer.tpl"}
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