From b35a723820774793d23441adf469584526769247 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Sat, 6 Mar 2010 10:25:13 +0000 Subject: [PATCH] web: introduce a block with recent blog posts --- web/drupal/modules/logger/logger.module | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/web/drupal/modules/logger/logger.module b/web/drupal/modules/logger/logger.module index f8115a7..b1bd877 100644 --- a/web/drupal/modules/logger/logger.module +++ b/web/drupal/modules/logger/logger.module @@ -3,6 +3,7 @@ // // logger.module : support module for charting data stored in RRD's // Copyright (c) 2008-2009 jokamajo.org +// 2010 flukso.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -493,23 +494,30 @@ function logger_block($op = 'list', $delta = 0, $edit = array()) { $blocks['subscriptions']['status'] = TRUE; $blocks['subscriptions']['region'] = 'right'; $blocks['subscriptions']['weight'] = 0; - $blocks['subscriptions']['pages'] = 'logger
logger/*'; + $blocks['subscriptions']['pages'] = '\nlogger/\nlogger/*'; $blocks['subscriptions']['cache'] = BLOCK_CACHE_PER_USER; $blocks['fluksonians']['info'] = t('Fluksonians'); $blocks['fluksonians']['status'] = TRUE; $blocks['fluksonians']['region'] = 'right'; $blocks['fluksonians']['weight'] = 1; - $blocks['fluksonians']['pages'] = 'logger
logger/*'; + $blocks['fluksonians']['pages'] = '\nlogger/\nlogger/*'; $blocks['fluksonians']['cache'] = BLOCK_CACHE_PER_USER; $blocks['unit']['info'] = t('Unit'); $blocks['unit']['status'] = TRUE; $blocks['unit']['region'] = 'right'; $blocks['unit']['weight'] = 2; - $blocks['unit']['pages'] = 'logger
logger/*'; + $blocks['unit']['pages'] = '\nlogger/\nlogger/*'; $blocks['unit']['cache'] = BLOCK_CACHE_PER_USER; + $blocks['posts']['info'] = t('Recent blog posts'); + $blocks['posts']['status'] = TRUE; + $blocks['posts']['region'] = 'right'; + $blocks['posts']['weight'] = 3; + $blocks['posts']['pages'] = '\nlogger/\nlogger/*'; + $blocks['posts']['cache'] = BLOCK_CACHE_GLOBAL; + return $blocks; case 'view': @@ -580,6 +588,15 @@ function logger_block($op = 'list', $delta = 0, $edit = array()) { $block['content'] = theme('logger_item_list', $items); } + elseif ($delta == 'posts' && user_access('access content')) { + $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blogpost' AND n.status = 1 ORDER BY n.created DESC"), 0, 5); + if ($node_title_list = node_title_list($result)) { + $block['subject'] = t('Recent blog posts'); + $block['content'] = $node_title_list; + $block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.')); + } + } + return $block; } }