From 9c4d4fe7b2d904d3c39c1a00b823e021005048f9 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 20 Jan 2006 09:09:18 +0000 Subject: [PATCH] - Patch #45228 and patch #45025 by m3avrck and Uwe: aggregator module HTML/CSS cleanups. --- misc/drupal.css | 17 ++++++--- modules/aggregator.module | 57 ++++++++++++---------------- modules/aggregator/aggregator.module | 57 ++++++++++++---------------- themes/bluemarine/style.css | 2 +- themes/chameleon/common.css | 2 +- themes/pushbutton/style.css | 2 +- 6 files changed, 63 insertions(+), 74 deletions(-) diff --git a/misc/drupal.css b/misc/drupal.css index 64c789f0909..f749d81554e 100644 --- a/misc/drupal.css +++ b/misc/drupal.css @@ -192,8 +192,15 @@ tr.odd .form-item, tr.even .form-item { /* ** Module specific styles */ -#aggregator .feed img { +#aggregator .feed-source .feed-title { + margin-top: 0; +} +#aggregator .feed-source .feed-image img { + margin-bottom: 0.75em; +} +#aggregator .feed-source .feed-icon { float: right; + display: block; } #aggregator .news-item { clear: both; @@ -206,7 +213,7 @@ tr.odd .form-item, tr.even .form-item { margin-top: 1em; margin-left: 1em; } -#aggregator .news-item .body .feed { +#aggregator .news-item .body .feed-source { font-size: 0.9em; } #aggregator .news-item .title { @@ -234,15 +241,15 @@ tr.odd .form-item, tr.even .form-item { .book .title { font-weight: bold; font-size: 1.3em; - margin-bottom:1em; + margin-bottom: 1em; } .book .tree { - padding-top:1em; + padding-top: 1em; border-top: 1px solid #888; padding-bottom: 1em; } .book .name { - padding-top:1em; + padding-top: 1em; font-weight: bold; font-size: 1em; } diff --git a/modules/aggregator.module b/modules/aggregator.module index e8624484474..bed24758906 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -423,7 +423,8 @@ function aggregator_refresh($feed) { } if ($image['LINK'] && $image['URL'] && $image['TITLE']) { - $image = ''. $image['TITLE'] .''; + // Note, we should really use theme_image() here but that only works with local images it won't work with images fetched with a URL unless PHP version > 5 + $image = ''. check_plain($image['TITLE']) .''; } else { $image = NULL; @@ -908,7 +909,7 @@ function aggregator_page_source() { $feed = db_fetch_object(db_query('SELECT * FROM {aggregator_feed} WHERE fid = %d', arg(2))); $info = theme('aggregator_feed', $feed); - return _aggregator_page_list('SELECT * FROM {aggregator_item} WHERE fid = '. $feed->fid .' ORDER BY timestamp DESC, iid DESC', arg(3), "
$info
"); + return _aggregator_page_list('SELECT * FROM {aggregator_item} WHERE fid = '. $feed->fid .' ORDER BY timestamp DESC, iid DESC', arg(3), $info); } /** @@ -1148,26 +1149,19 @@ function aggregator_page_categories() { * @ingroup themeable */ function theme_aggregator_feed($feed) { - $output = ''; + $output = '
'; + $output .= theme('feed_icon', $feed->url) ."\n"; + $output .= $feed->image . '

'. check_plain($feed->title) ."

\n"; + $output .= '
'. t('Description:') .' '. filter_xss($feed->description) ."
\n"; - if ($feed->image) { - $output .= $feed->image; - } - - $output .= $feed->description; - $output .= '

'. t('URL') ."

\n"; - $output .= theme('xml_icon', $feed->url); - $output .= ''. check_plain($feed->link) ."\n"; - $output .= '

'. t('Last update') ."

\n"; $updated = t('%time ago', array('%time' => format_interval(time() - $feed->checked))); - if (user_access('administer news feeds')) { - $output .= l($updated, 'admin/aggregator'); - } - else { - $output .= $updated; + $updated = l($updated, 'admin/aggregator'); } + $output .= '
'. t('Updated:') . " $updated
"; + $output .= "
\n"; + return $output; } @@ -1214,27 +1208,25 @@ function theme_aggregator_summary_item($item) { * @ingroup themeable */ function theme_aggregator_page_item($item) { - static $last; - - $date = format_date($item->timestamp, 'custom', 'Ymd'); - if ($date != $last) { - $last = $date; - $output .= '

'. format_date($item->timestamp, 'custom', 'F j, Y') ."

\n"; - } - - $output .= "
\n"; - $output .= '
'. format_date($item->timestamp, 'custom', 'H:i') ."
\n"; - $output .= "
\n"; $source = ''; if ($item->ftitle && $item->fid) { - $source = ''. l($item->ftitle, "aggregator/sources/$item->fid") .":\n"; + $source = l($item->ftitle, "aggregator/sources/$item->fid", array('class' => 'feed-item-source')) . ' -'; } - $output .= ' \n"; + if (date('Ymd', $item->timestamp) == date('Ymd')) { + $source_date = t('%ago ago', array('%ago' => format_interval(time() - $item->timestamp))); + } + else { + $source_date = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, Y-m-d H:i')); + } + + $output .= "
\n"; + $output .= '

'. check_plain($item->title) ."

\n"; + $output .= "
$source $source_date
\n"; if ($item->description) { - $output .= '
'. $item->description ."
\n"; + $output .= '
'. filter_xss($item->description) ."
\n"; } $result = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = %d ORDER BY c.title', $item->iid); @@ -1243,10 +1235,9 @@ function theme_aggregator_page_item($item) { $categories[] = l($category->title, 'aggregator/categories/'. $category->cid); } if ($categories) { - $output .= '
'. t('Categories') .': '. implode(', ', $categories) ."
\n"; + $output .= '
'. t('Categories') .': '. implode(', ', $categories) ."
\n"; } - $output .= "
\n"; $output .= "
\n"; return $output; diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index e8624484474..bed24758906 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -423,7 +423,8 @@ function aggregator_refresh($feed) { } if ($image['LINK'] && $image['URL'] && $image['TITLE']) { - $image = ''. $image['TITLE'] .''; + // Note, we should really use theme_image() here but that only works with local images it won't work with images fetched with a URL unless PHP version > 5 + $image = ''. check_plain($image['TITLE']) .''; } else { $image = NULL; @@ -908,7 +909,7 @@ function aggregator_page_source() { $feed = db_fetch_object(db_query('SELECT * FROM {aggregator_feed} WHERE fid = %d', arg(2))); $info = theme('aggregator_feed', $feed); - return _aggregator_page_list('SELECT * FROM {aggregator_item} WHERE fid = '. $feed->fid .' ORDER BY timestamp DESC, iid DESC', arg(3), "
$info
"); + return _aggregator_page_list('SELECT * FROM {aggregator_item} WHERE fid = '. $feed->fid .' ORDER BY timestamp DESC, iid DESC', arg(3), $info); } /** @@ -1148,26 +1149,19 @@ function aggregator_page_categories() { * @ingroup themeable */ function theme_aggregator_feed($feed) { - $output = ''; + $output = '
'; + $output .= theme('feed_icon', $feed->url) ."\n"; + $output .= $feed->image . '

'. check_plain($feed->title) ."

\n"; + $output .= '
'. t('Description:') .' '. filter_xss($feed->description) ."
\n"; - if ($feed->image) { - $output .= $feed->image; - } - - $output .= $feed->description; - $output .= '

'. t('URL') ."

\n"; - $output .= theme('xml_icon', $feed->url); - $output .= ''. check_plain($feed->link) ."\n"; - $output .= '

'. t('Last update') ."

\n"; $updated = t('%time ago', array('%time' => format_interval(time() - $feed->checked))); - if (user_access('administer news feeds')) { - $output .= l($updated, 'admin/aggregator'); - } - else { - $output .= $updated; + $updated = l($updated, 'admin/aggregator'); } + $output .= '
'. t('Updated:') . " $updated
"; + $output .= "
\n"; + return $output; } @@ -1214,27 +1208,25 @@ function theme_aggregator_summary_item($item) { * @ingroup themeable */ function theme_aggregator_page_item($item) { - static $last; - - $date = format_date($item->timestamp, 'custom', 'Ymd'); - if ($date != $last) { - $last = $date; - $output .= '

'. format_date($item->timestamp, 'custom', 'F j, Y') ."

\n"; - } - - $output .= "
\n"; - $output .= '
'. format_date($item->timestamp, 'custom', 'H:i') ."
\n"; - $output .= "
\n"; $source = ''; if ($item->ftitle && $item->fid) { - $source = ''. l($item->ftitle, "aggregator/sources/$item->fid") .":\n"; + $source = l($item->ftitle, "aggregator/sources/$item->fid", array('class' => 'feed-item-source')) . ' -'; } - $output .= ' \n"; + if (date('Ymd', $item->timestamp) == date('Ymd')) { + $source_date = t('%ago ago', array('%ago' => format_interval(time() - $item->timestamp))); + } + else { + $source_date = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, Y-m-d H:i')); + } + + $output .= "
\n"; + $output .= '

'. check_plain($item->title) ."

\n"; + $output .= "
$source $source_date
\n"; if ($item->description) { - $output .= '
'. $item->description ."
\n"; + $output .= '
'. filter_xss($item->description) ."
\n"; } $result = db_query('SELECT c.title, c.cid FROM {aggregator_category_item} ci LEFT JOIN {aggregator_category} c ON ci.cid = c.cid WHERE ci.iid = %d ORDER BY c.title', $item->iid); @@ -1243,10 +1235,9 @@ function theme_aggregator_page_item($item) { $categories[] = l($category->title, 'aggregator/categories/'. $category->cid); } if ($categories) { - $output .= '
'. t('Categories') .': '. implode(', ', $categories) ."
\n"; + $output .= '
'. t('Categories') .': '. implode(', ', $categories) ."
\n"; } - $output .= "
\n"; $output .= "
\n"; return $output; diff --git a/themes/bluemarine/style.css b/themes/bluemarine/style.css index b19b268dc2f..b62e2716f95 100644 --- a/themes/bluemarine/style.css +++ b/themes/bluemarine/style.css @@ -272,7 +272,7 @@ table { /* ** Module specific styles */ -#aggregator .feed { +#aggregator .feed-source { background-color: #eee; border: 1px solid #ccc; padding: 1em; diff --git a/themes/chameleon/common.css b/themes/chameleon/common.css index 20eef4c5285..8d8041564ab 100644 --- a/themes/chameleon/common.css +++ b/themes/chameleon/common.css @@ -145,7 +145,7 @@ br { .form-item textarea { font-size: 1em; } -#aggregator .feed { +#aggregator .feed-source { border: 1px solid gray; padding: 1em; } diff --git a/themes/pushbutton/style.css b/themes/pushbutton/style.css index 389c7bcb091..9f622533962 100644 --- a/themes/pushbutton/style.css +++ b/themes/pushbutton/style.css @@ -482,7 +482,7 @@ table#footer-menu { .content .active { color: #369; } -#aggregator .feed { +#aggregator .feed-source { background-color: #eee; border: 1px solid #ccc; padding: 1em;