Index: recent_blocks.module
===================================================================
--- recent_blocks.module (revision 8613)
+++ recent_blocks.module (working copy)
@@ -57,6 +57,7 @@
'url_href' => '',
'url_text' => '',
'comments_only' => '0',
+ 'time_granularity' => 2,
'mode_co_show' => array('mark', 'comment date'),
'mode_full_show' => array('mark', 'node date', 'comments number'),
'mode_full_wow_comments' => 'with or without',
@@ -112,7 +113,7 @@
$items[] = l($subject, "node/$comment->nid", NULL, NULL, 'comment-'. $comment->cid) .
($s['mode_co_show']['mark'] ? ' '. theme('mark', node_mark($comment->nid, $comment->timestamp)) : '') .
($s['username_show'] ? " (".l($comment->name,'user/'.$comment->uid).')' : '').
- ($s['mode_co_show']['comment date'] ? '
'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp))) : '');
+ ($s['mode_co_show']['comment date'] ? '
'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp, $s['time_granularity']))) : '');
}
}
else {
@@ -140,9 +141,9 @@
($show['teaser'] ? ' '. t(strip_tags($node->teaser,'
')) : '') .
($show['mark'] ? ' '. theme('mark', node_mark($node->nid, $node->changed)) : '') .
($s['username_show'] ? " (".l($node->name,'user/'.$node->uid).')' : '').
- ($show['node date'] ? '
'. t('%time ago', array('%time' => format_interval(time() - $node->$s['mode_full_sort']))) : '') .
+ ($show['node date'] ? '
'. t('%time ago', array('%time' => format_interval(time() - $node->$s['mode_full_sort'], $s['time_granularity']))) : '') .
($comments_no ? '
'. $comments_no : '') .
- ($comments_no && $show['comment date'] ? '
'. t('%time ago', array('%time' => format_interval(time() - $node->last_comment_timestamp))) : '');
+ ($comments_no && $show['comment date'] ? '
'. t('%time ago', array('%time' => format_interval(time() - $node->last_comment_timestamp, $s['time_granularity']))) : '');
$items[] = $item;
}
@@ -269,6 +270,17 @@
'#description' => t('The text to display, e.g. more'),
'#default_value' => $settings["url_text"],
);
+ $form["recent_blocks_$delta"]["general"]["time_granularity"] = array(
+ '#type' => 'radios',
+ '#title' => t('Time Granularity'),
+ '#description' => t('How granular to display times?'),
+ '#default_value' => $settings["time_granularity"],
+ '#options' => array(
+ '1' => t(format_interval(time(),1)),
+ '2' => t(format_interval(time(),2)),
+ '3' => t(format_interval(time(),3)),
+ '4' => t(format_interval(time(),4))),
+ );
$form["recent_blocks_$delta"]["mode_selection"] = array(
'#type' => 'fieldset',