Commit 54b77d64 authored by Dries's avatar Dries

Tabs patch!

CHANGES
-------

 + Introduced tabs. First, we extended the menu system to support tabs. Next, a tab was added for every link that was (1) an administrative action other than the implicit 'view' (2) relevant to that particular page only. This is illustrated by the fact that all tabs are verbs and that clicking a page's tab leads you to a subpage of that page.

 + Flattened the administration menu. The tabs helped simplify the navigation menu as I could separate 'actions' from 'navigation'. In addition, I removed the 'administer > configuration'-menu, renamed 'blocks' to 'sidebars' which I hope is a bit more descriptive, and made a couple more changes. Earlier, we already renamed 'taxonomy' to 'categorization' and we move 'statistics' under 'logs'.

 + Grouped settings. All settings have been grouped under 'administer > settings'.

TODO
----

 + Update core themes: only Xtemplate default supports tabs and even those look ugly.  Need help.

 + Update contributed modules.  The menu() hook changed drastically.  Updating your code adhere the new menu() function should be 90% of the work.  Moreover, ensure that your modue's admin links are still valid and that URLs to node get updated to the new scheme ('node/view/x' -> 'node/x').
parent 5ad73c8e
......@@ -268,8 +268,7 @@ CREATE TABLE menu (
path varchar(255) NOT NULL default '',
title varchar(255) NOT NULL default '',
weight tinyint(4) NOT NULL default '0',
visibility int(1) unsigned NOT NULL default '0',
status int(1) unsigned NOT NULL default '0',
type int(2) unsigned NOT NULL default '0',
PRIMARY KEY (mid)
) TYPE=MyISAM;
......
......@@ -268,8 +268,7 @@ CREATE TABLE menu (
path varchar(255) NOT NULL default '',
title varchar(255) NOT NULL default '',
weight smallint NOT NULL default '0',
visibility smallint NOT NULL default '0',
status smallint NOT NULL default '0',
type smallint NOT NULL default '0',
PRIMARY KEY (mid)
);
......
......@@ -58,7 +58,8 @@
"2004-04-21" => "update_84",
"2004-04-27" => "update_85",
"2004-05-10" => "update_86",
"2004-05-18" => "update_87"
"2004-05-18" => "update_87",
"2004-06-11" => "update_88"
);
function update_32() {
......@@ -1093,6 +1094,15 @@ function update_87() {
return $ret;
}
function update_88() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {menu} DROP status");
$ret[] = update_sql("ALTER TABLE {menu} DROP visibility");
$ret[] = update_sql("ALTER TABLE {menu} ADD type INT(2) UNSIGNED DEFAULT '0' NOT NULL");
$ret[] = update_sql("DELETE FROM {menu}");
return $ret;
}
function update_sql($sql) {
$edit = $_POST["edit"];
$result = db_query($sql);
......
<?php
/* $Id$ */
/**
* @defgroup common Core functions
*/
/**
* @name Page title
* @ingroup common
......@@ -949,12 +945,7 @@ function format_name($object) {
$name = $object->name;
}
if (arg(0) == "admin" and user_access("administer users")) {
$output = l($name, "admin/user/edit/$object->uid", array("title" => t("Administer user profile.")));
}
else {
$output = l($name, "user/view/$object->uid", array("title" => t("View user profile.")));
}
$output = l($name, "user/$object->uid", array("title" => t("View user profile.")));
}
else if ($object->name) {
/*
......
This diff is collapsed.
......@@ -9,7 +9,7 @@
* The theme system allows for nearly all output of the Drupal system to be
* customized by user themes.
*
* @see <a href="http://drupal.org/node/view/253">Theme system</a>
* @see <a href="http://drupal.org/node/253">Theme system</a>
* @see themeable
*/
......@@ -24,7 +24,7 @@ function theme_help($section) {
$output = '';
switch ($section) {
case 'admin/system/themes#description':
case 'admin/themes#description':
$output = t("The base theme");
break;
}
......@@ -142,6 +142,7 @@ function theme_page($content, $title = NULL, $breadcrumb = NULL) {
if (isset($title)) {
drupal_set_title($title);
}
if (isset($breadcrumb)) {
drupal_set_breadcrumb($breadcrumb);
}
......@@ -162,6 +163,11 @@ function theme_page($content, $title = NULL, $breadcrumb = NULL) {
$output .= theme("breadcrumb", drupal_get_breadcrumb());
$output .= "<h1>" . drupal_get_title() . "</h1>";
if ($tabs = theme('menu_local_tasks')) {
$output .= $tabs;
}
if ($help = menu_get_active_help()) {
$output .= "<small>$help</small><hr />";
}
......@@ -300,6 +306,17 @@ function theme_form_element($title, $value, $description = NULL, $id = NULL, $re
return $output;
}
/**
* Returns themed sub menu, typically displayed under the tabs.
*
* @param $menus an associative array of links.
*/
function theme_submenu($links) {
return "<div class=\"submenu\">". implode(' | ', $links) ."</div>";
}
/**
* Returns themed table.
*
......
......@@ -9,13 +9,12 @@
$status = menu_execute_active_handler();
switch ($status) {
case MENU_FOUND:
case MENU_NOT_FOUND:
drupal_not_found();
break;
case MENU_DENIED:
case MENU_ACCESS_DENIED:
drupal_access_denied();
break;
default:
drupal_not_found();
}
drupal_page_footer();
......
......@@ -83,7 +83,6 @@ li a.active {
td.menu-disabled {
background: #ccc;
}
/*
** Other common styles
*/
......
......@@ -6,7 +6,7 @@
*/
function admin_help($section) {
switch ($section) {
case 'admin/system/modules#description':
case 'admin/modules#description':
return t('Handles the administration pages.');
case 'admin':
return t('Welcome to the administration section. Below are the most recent system events.');
......@@ -14,12 +14,15 @@ function admin_help($section) {
}
/**
* Implementation of hook_link().
* Implementation of hook_menu().
*/
function admin_link($type) {
if ($type == 'system') {
menu('admin', t('administer'), user_access('access administration pages') ? 'admin_main_page' : MENU_DENIED, 9);
}
function admin_menu() {
$items = array();
$items[] = array('path' => 'admin', 'title' => t('administer'),
'access' => user_access('access administration pages'),
'callback' => 'admin_main_page',
'weight' => 9);
return $items;
}
/**
......
......@@ -17,8 +17,8 @@ function aggregator_help($section) {
<p>To learn much more about RSS, read Mark Pilgrim\'s <a href="http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html">What is RSS</a> and WebReference.com\'s <a href="http://www.webreference.com/authoring/languages/xml/rss/1/">The Evolution of RSS</a>.</p>
<p>NOTE: Enable your site\'s XML syndication button by turning on the Syndicate block in block management.</p>
<h3>Adding news feeds</h3>
<p>To subscribe to an RSS feed on another site, use the <a href="%admin-news">RSS/RDF</a> administration page.</p>
<p>Once there, select <a href="%new-feed">new feed</a> from the menu. Drupal will then ask for the following:</p>
<p>To subscribe to an RSS feed on another site, use the <a href="%admin-news">aggregation page</a>.</p>
<p>Once there, click the <a href="%new-feed">new feed</a> tab. Drupal will then ask for the following:</p>
<ul>
<li><strong>Title</strong> -- The text entered here will be used in your news aggregator, within the administration configuration section, and as title for the news feed block. As a general rule, use the web site name from which the feed originates.</li>
<li><strong>URL</strong> -- Here you\'ll enter the fully-qualified URL for the feed for the site you want to subscribe to.</li>
......@@ -26,9 +26,9 @@ function aggregator_help($section) {
<li><strong>Latest items block</strong> -- The number of items selected here will determine how many of the latest items from the feed will appear in a block which may be enabled and placed in the <a href="%block">blocks</a> administration page.</li>
<li><strong>Automatically file items</strong> -- As items are recieved from a feed they will be put in the checked categories.</li>
</ul>
<p>Once you submit your new feed, check to see if it is working properly. Select <a href="%update-items">update items</a> on the <a href="%admin-news">RSS/RDF</a> page. If you do not see any items listed for that feed, edit the feed and make sure that the URL was entered correctly.</p>
<p>Once you submit your new feed, check to see if it is working properly. Select <a href="%update-items">update items</a> on the <a href="%admin-news">aggregation page</a>. If you do not see any items listed for that feed, edit the feed and make sure that the URL was entered correctly.</p>
<h3>Adding categories</h3>
<p>News items can be filed into categories. To create a category, start at the <a href="%admin-news">RSS/RDF</a> administration page.</p>
<p>News items can be filed into categories. To create a category, start at the <a href="%admin-news">aggregation page</a>.</p>
<p>Once there, select <a href="%new-category">new category</a> from the menu. Drupal will then ask for the following:</p>
<ul>
<li><strong>Title</strong> -- The title will be used in the <i>news by topics</i> listing in your news aggregator and with the customized block created for the bundle.</li>
......@@ -53,13 +53,13 @@ function aggregator_help($section) {
<h3>Technical details</h3>
<p>Drupal automatically generates an OPML feed file that is available by selecting the XML icon on the News Sources page.</p>
<p>When fetching feeds Drupal supports conditional GETs, this reduces the bandwidth usage for feeds that have not been updated since the last check.</p>
<p>If a feed is permanently moved to a new location Drupal will automatically update the feed URL to the new address.</p>', array('%block' => url('admin/system/block'), '%admin-news' => url('admin/aggregator'), '%new-feed' => url('admin/aggregator/add/feed'), '%new-category' => url('admin/aggregator/add/category'), '%update-items' => url('admin/aggregator'), '%news-aggregator' => url('aggregator'), '%sources' => url('aggregator/sources'), '%categories' => url('aggregator/categories')));
case 'admin/system/modules#description':
<p>If a feed is permanently moved to a new location Drupal will automatically update the feed URL to the new address.</p>', array('%block' => url('admin/block'), '%admin-news' => url('admin/aggregator'), '%new-feed' => url('admin/aggregator/add/feed'), '%new-category' => url('admin/aggregator/add/category'), '%update-items' => url('admin/aggregator'), '%news-aggregator' => url('aggregator'), '%sources' => url('aggregator/sources'), '%categories' => url('aggregator/categories')));
case 'admin/modules#description':
return t('Used to aggregate syndicated content (RSS and RDF).');
case 'admin/system/modules/aggregator':
case 'admin/settings/aggregator':
return t('These settings control the display of aggregated content.');
case 'admin/aggregator':
return t('Several web sites, especially news related sites, syndicate parts of their site\'s content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS) or Resource Description Framework (RDF). To get a feed to work you <strong>must</strong> have <a href=\"%cron\">cron</a> working. To display the feed or categoty in a block you must decide how many items to show by editing the feed or block and turn on the <a href="%block">feed\'s block</a>.', array('%block' => url('admin/system/block'), '%cron' => url('admin/help', NULL, 'cron')));
return t('Several web sites, especially news related sites, syndicate parts of their site\'s content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS) or Resource Description Framework (RDF). To get a feed to work you <strong>must</strong> have <a href=\"%cron\">cron</a> working. To display the feed or categoty in a block you must decide how many items to show by editing the feed or block and turn on the <a href="%block">feed\'s block</a>.', array('%block' => url('admin/block'), '%cron' => url('admin/help', NULL, 'cron')));
case 'admin/aggregator/add/feed':
return t('Add a site that has an RSS/RDF feed. The URL is the full path to the RSS feed file. For the feed to update automatically you must run "cron.php". If you already have a feed with the URL you are planning to use, the system will not accept another feed with the same URL.');
case 'admin/aggregator/add/category':
......@@ -74,10 +74,11 @@ function aggregator_help_page() {
print theme('page', aggregator_help('admin/help#aggregator'));
}
/**
* Implementation of hook_settings().
*/
function aggregator_settings() {
function aggregator_configure() {
if ($_POST) {
system_settings_save();
}
$output = '';
$number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100));
$items = array(0 => t('none'), 3 => t('3 items'), 5 => t('5 items'), 10 => t('10 items'), 15 => t('15 items'), 20 => t('20 items'), 25 => t('25 items'));
......@@ -85,7 +86,7 @@ function aggregator_settings() {
$output .= form_select(t('Items shown in sources and categories pages'), 'aggregator_summary_items', variable_get('aggregator_summary_items', 3), $items, t('The number of items which will be shown with each feed or category in the feed and category summary pages.'));
$output .= form_radios(t('Category selection type'), 'aggregator_category_selector', variable_get('aggregator_category_selector', 'check'), array('check' => t('checkboxes'), 'select' => t('multiple selector')), t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.'));
return $output;
print theme('page', system_settings_form($output));
}
/**
......@@ -102,43 +103,91 @@ function aggregator_link($type) {
if ($type == 'page' && user_access('access news feeds')) {
return array(l(t('news feeds'), 'aggregator', array('title' => t('Read the latest news from syndicated web sites.'))));
}
}
if ($type == 'system') {
$access = user_access('administer news feeds');
menu('admin/aggregator', t('aggregator'), $access ? 'aggregator_admin_overview' : MENU_DENIED);
menu('admin/aggregator/add/feed', t('new feed'), $access ? 'aggregator_admin_edit_feed' : MENU_DENIED, 2);
menu('admin/aggregator/edit/feed', t('edit feed'), $access ? 'aggregator_admin_edit_feed' : MENU_DENIED, 2, MENU_HIDE);
menu('admin/aggregator/add/category', t('new category'), $access ? 'aggregator_admin_edit_category' : MENU_DENIED, 3);
menu('admin/aggregator/edit/category', t('edit category'), $access ? 'aggregator_admin_edit_category' : MENU_DENIED, 3, MENU_HIDE);
menu('admin/aggregator/remove', t('remove items'), $access ? 'aggregator_admin_remove_feed' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
menu('admin/aggregator/update', t('update items'), $access ? 'aggregator_admin_refresh_feed' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
menu('admin/aggregator/help', t('help'), $access ? 'aggregator_help_page' : MENU_DENIED, 9);
$access = user_access('access news feeds');
menu('aggregator', t('news aggregator'), $access ? 'aggregator_page_last' : MENU_DENIED, 5);
menu('aggregator/sources', t('sources'), $access ? 'aggregator_page_sources' : MENU_DENIED, 0);
menu('aggregator/categories', t('categories'), $access ? 'aggregator_page_categories' : MENU_DENIED, 1, MENU_HIDE_NOCHILD);
// To reduce the number of SQL queries, we don't query the database when
// not on an aggregator page.
// If caching of the menu is implemented, this check should be removed
// so that DHTML menu presentation can be used correctly.
if (arg(0) == 'aggregator') {
// Sources:
$result = db_query('SELECT title, fid FROM {aggregator_feed} ORDER BY title');
while ($feed = db_fetch_object($result)) {
menu('aggregator/sources/'. $feed->fid, $feed->title, $access ? 'aggregator_page_source' : MENU_DENIED);
}
/**
* Implementation of hook_menu().
*/
function aggregator_menu() {
$items = array();
// Categories:
$result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title');
while ($category = db_fetch_object($result)) {
menu('aggregator/categories/'. $category->cid, $category->title, $access ? 'aggregator_page_category' : MENU_DENIED);
}
$edit = user_access('administer news feeds');
$view = user_access('access news feeds');
$items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'),
'callback' => 'aggregator_admin_overview', 'access' => $edit);
$items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/edit/category', 'title' => t('edit category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/remove', 'title' => t('remove items'),
'callback' => 'aggregator_admin_remove_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/update', 'title' => t('update items'),
'callback' => 'aggregator_admin_refresh_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
// Tabs:
$items[] = array('path' => 'admin/aggregator/add/feed', 'title' => t('add feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/add/category', 'title' => t('add category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/aggregator/configure', 'title' => t('configure'),
'callback' => 'aggregator_configure', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'aggregator', 'title' => t('news aggregator'),
'callback' => 'aggregator_page_last', 'access' => $view,
'weight' => 5);
$items[] = array('path' => 'aggregator/sources', 'title' => t('sources'),
'callback' => 'aggregator_page_sources', 'access' => $view);
$items[] = array('path' => 'aggregator/categories', 'title' => t('categories'),
'callback' => 'aggregator_page_categories', 'access' => $view,
'type' => MENU_ITEM_GROUPING);
// To reduce the number of SQL queries, we don't query the database when
// not on an aggregator page.
// If caching of the menu is implemented, this check should be removed
// so that DHTML menu presentation can be used correctly.
if (arg(0) == 'aggregator') {
// Sources:
$result = db_query('SELECT title, fid FROM {aggregator_feed} ORDER BY title');
while ($feed = db_fetch_object($result)) {
$items[] = array('path' => 'aggregator/sources/'. $feed->fid, 'title' => $feed->title,
'callback' => 'aggregator_page_source', 'access' => $view);
$items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/categorize', 'title' => t('categorize'),
'callback' => 'aggregator_page_source', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'aggregator/sources/'. $feed->fid .'/configure', 'title' => t('configure'),
'callback' => 'aggregator_edit', 'access' => $edit,
'type' => MENU_LOCAL_TASK,
'weight' => 1);
}
menu('aggregator/opml', t('opml'), $access ? 'aggregator_page_opml' : MENU_DENIED, '', MENU_HIDE);
// Categories:
$result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title');
while ($category = db_fetch_object($result)) {
$items[] = array('path' => 'aggregator/categories/'. $category->cid, 'title' => $category->title,
'callback' => 'aggregator_page_category', 'access' => $view);
$items[] = array('path' => 'aggregator/categories/'. $category->cid .'/categorize', 'title' => t('categorize'),
'callback' => 'aggregator_page_category', 'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'aggregator/categories/'. $category->cid .'/configure', 'title' => t('configure'),
'callback' => 'aggregator_edit', 'access' => $edit,
'type' => MENU_LOCAL_TASK,
'weight' => 1);
}
}
$items[] = array('path' => 'aggregator/opml', 'title' => t('opml'),
'callback' => 'aggregator_page_opml', 'access' => $view,
'type' => MENU_CALLBACK);
return $items;
}
/**
......@@ -501,7 +550,7 @@ function aggregator_form_category($edit = array()) {
$form = form_textfield(t('Title'), 'title', $edit['title'], 50, 64);
$form .= form_textarea(t('Description'), 'description', $edit['description'], 60, 5);
$form .= form_select(t('Latest items block'), 'block', $edit['block'], $block_items, t('If enabled, a block containing the latest items in this category will be availiable for placement on the <a href="%url">block configuration</a> page.', array('%url' => url('admin/system/block'))));
$form .= form_select(t('Latest items block'), 'block', $edit['block'], $block_items, t('If enabled, a block containing the latest items in this category will be availiable for placement on the <a href="%url">block configuration</a> page.', array('%url' => url('admin/block'))));
$form .= form_submit(t('Submit'));
if ($edit['cid']) {
......@@ -537,7 +586,7 @@ function aggregator_form_feed($edit = array()) {
$form .= form_textfield(t('Title'), 'title', $edit['title'], 50, 64, t('The name of the feed; typically the name of the web site you syndicate content from.'));
$form .= form_textfield(t('URL'), 'url', $edit['url'], 50, 128, t('The fully-qualified URL of the feed.'));
$form .= form_select(t('Update interval'), 'refresh', $edit['refresh'], $period, t('The refresh interval indicating how often you want to update this feed. Requires crontab.'));
$form .= form_select(t('Latest items block'), 'block', $edit['block'], $block_items, t('If enabled, a block containing the latest items from this feed will be availiable for placement on the <a href="%url">block configuration</a> page.', array('%url' => url('admin/system/block'))));
$form .= form_select(t('Latest items block'), 'block', $edit['block'], $block_items, t('If enabled, a block containing the latest items from this feed will be availiable for placement on the <a href="%url">block configuration</a> page.', array('%url' => url('admin/block'))));
$categories = db_query('SELECT c.cid, c.title, f.fid FROM {aggregator_category} c LEFT JOIN {aggregator_category_feed} f ON c.cid = f.cid AND f.fid = %d ORDER BY title', $edit['fid']);
while ($category = db_fetch_object($categories)) {
$checkboxes .= form_checkbox($category->title, "category][$category->cid", 1, $category->fid ? 1 : 0);
......@@ -626,6 +675,45 @@ function aggregator_view() {
return $output;
}
function aggregator_edit() {
if ($_POST['op'] == t('Submit')) {
if (arg(1) == 'categories') {
aggregator_save_category($_POST['edit']);
drupal_set_message(t('The category has been updated.'));
}
else {
aggregator_save_feed($_POST['edit']);
drupal_set_message(t('The feed has been updated.'));
}
}
else if ($_POST['op'] == t('Delete')) {
// Unset the title:
unset($_POST['edit']['title']);
if (arg(1) == 'categories') {
aggregator_save_category($_POST['edit']);
drupal_set_message(t('The category has been deleted.'));
}
else {
aggregator_save_feed($_POST['edit']);
drupal_set_message(t('The feed has been deleted.'));
}
drupal_goto('aggregator');
}
if (arg(1) == 'categories') {
$output = aggregator_form_category(aggregator_get_category(arg(2)));
}
else {
$output = aggregator_form_feed(aggregator_get_feed(arg(2)));
}
print theme('page', $output);
}
/**
* Menu callback; displays the category edit form, or saves changes and
* displays the overview page.
......@@ -743,15 +831,11 @@ function _aggregator_page_list($sql, $op, $header = '') {
}
}
}
$links[] = l(t('categorize news items'), $_GET['q']);
}
else {
$categorize = true;
}
}
if (user_access('administer news feeds') && $op != 'categorize') {
$links[] = l(t('categorize news items'), $_GET['q'] .'/categorize');
}
$output = '<div id="aggregator">';
if ($header) {
......
......@@ -17,8 +17,8 @@ function aggregator_help($section) {
<p>To learn much more about RSS, read Mark Pilgrim\'s <a href="http://www.xml.com/pub/a/2002/12/18/dive-into-xml.html">What is RSS</a> and WebReference.com\'s <a href="http://www.webreference.com/authoring/languages/xml/rss/1/">The Evolution of RSS</a>.</p>
<p>NOTE: Enable your site\'s XML syndication button by turning on the Syndicate block in block management.</p>
<h3>Adding news feeds</h3>
<p>To subscribe to an RSS feed on another site, use the <a href="%admin-news">RSS/RDF</a> administration page.</p>
<p>Once there, select <a href="%new-feed">new feed</a> from the menu. Drupal will then ask for the following:</p>
<p>To subscribe to an RSS feed on another site, use the <a href="%admin-news">aggregation page</a>.</p>
<p>Once there, click the <a href="%new-feed">new feed</a> tab. Drupal will then ask for the following:</p>
<ul>
<li><strong>Title</strong> -- The text entered here will be used in your news aggregator, within the administration configuration section, and as title for the news feed block. As a general rule, use the web site name from which the feed originates.</li>
<li><strong>URL</strong> -- Here you\'ll enter the fully-qualified URL for the feed for the site you want to subscribe to.</li>
......@@ -26,9 +26,9 @@ function aggregator_help($section) {
<li><strong>Latest items block</strong> -- The number of items selected here will determine how many of the latest items from the feed will appear in a block which may be enabled and placed in the <a href="%block">blocks</a> administration page.</li>
<li><strong>Automatically file items</strong> -- As items are recieved from a feed they will be put in the checked categories.</li>
</ul>
<p>Once you submit your new feed, check to see if it is working properly. Select <a href="%update-items">update items</a> on the <a href="%admin-news">RSS/RDF</a> page. If you do not see any items listed for that feed, edit the feed and make sure that the URL was entered correctly.</p>
<p>Once you submit your new feed, check to see if it is working properly. Select <a href="%update-items">update items</a> on the <a href="%admin-news">aggregation page</a>. If you do not see any items listed for that feed, edit the feed and make sure that the URL was entered correctly.</p>
<h3>Adding categories</h3>
<p>News items can be filed into categories. To create a category, start at the <a href="%admin-news">RSS/RDF</a> administration page.</p>
<p>News items can be filed into categories. To create a category, start at the <a href="%admin-news">aggregation page</a>.</p>
<p>Once there, select <a href="%new-category">new category</a> from the menu. Drupal will then ask for the following:</p>
<ul>
<li><strong>Title</strong> -- The title will be used in the <i>news by topics</i> listing in your news aggregator and with the customized block created for the bundle.</li>
......@@ -53,13 +53,13 @@ function aggregator_help($section) {
<h3>Technical details</h3>
<p>Drupal automatically generates an OPML feed file that is available by selecting the XML icon on the News Sources page.</p>
<p>When fetching feeds Drupal supports conditional GETs, this reduces the bandwidth usage for feeds that have not been updated since the last check.</p>
<p>If a feed is permanently moved to a new location Drupal will automatically update the feed URL to the new address.</p>', array('%block' => url('admin/system/block'), '%admin-news' => url('admin/aggregator'), '%new-feed' => url('admin/aggregator/add/feed'), '%new-category' => url('admin/aggregator/add/category'), '%update-items' => url('admin/aggregator'), '%news-aggregator' => url('aggregator'), '%sources' => url('aggregator/sources'), '%categories' => url('aggregator/categories')));
case 'admin/system/modules#description':
<p>If a feed is permanently moved to a new location Drupal will automatically update the feed URL to the new address.</p>', array('%block' => url('admin/block'), '%admin-news' => url('admin/aggregator'), '%new-feed' => url('admin/aggregator/add/feed'), '%new-category' => url('admin/aggregator/add/category'), '%update-items' => url('admin/aggregator'), '%news-aggregator' => url('aggregator'), '%sources' => url('aggregator/sources'), '%categories' => url('aggregator/categories')));
case 'admin/modules#description':
return t('Used to aggregate syndicated content (RSS and RDF).');
case 'admin/system/modules/aggregator':
case 'admin/settings/aggregator':
return t('These settings control the display of aggregated content.');
case 'admin/aggregator':
return t('Several web sites, especially news related sites, syndicate parts of their site\'s content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS) or Resource Description Framework (RDF). To get a feed to work you <strong>must</strong> have <a href=\"%cron\">cron</a> working. To display the feed or categoty in a block you must decide how many items to show by editing the feed or block and turn on the <a href="%block">feed\'s block</a>.', array('%block' => url('admin/system/block'), '%cron' => url('admin/help', NULL, 'cron')));
return t('Several web sites, especially news related sites, syndicate parts of their site\'s content for other web sites to display. Usually, the syndicated content includes the latest headlines with a direct link to that story on the remote site. Some syndicated content also includes a description of the headline. The standard method of syndication is using the XML based Rich Site Summary (RSS) or Resource Description Framework (RDF). To get a feed to work you <strong>must</strong> have <a href=\"%cron\">cron</a> working. To display the feed or categoty in a block you must decide how many items to show by editing the feed or block and turn on the <a href="%block">feed\'s block</a>.', array('%block' => url('admin/block'), '%cron' => url('admin/help', NULL, 'cron')));
case 'admin/aggregator/add/feed':
return t('Add a site that has an RSS/RDF feed. The URL is the full path to the RSS feed file. For the feed to update automatically you must run "cron.php". If you already have a feed with the URL you are planning to use, the system will not accept another feed with the same URL.');
case 'admin/aggregator/add/category':
......@@ -74,10 +74,11 @@ function aggregator_help_page() {
print theme('page', aggregator_help('admin/help#aggregator'));
}
/**
* Implementation of hook_settings().
*/
function aggregator_settings() {
function aggregator_configure() {
if ($_POST) {
system_settings_save();
}
$output = '';
$number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100));
$items = array(0 => t('none'), 3 => t('3 items'), 5 => t('5 items'), 10 => t('10 items'), 15 => t('15 items'), 20 => t('20 items'), 25 => t('25 items'));
......@@ -85,7 +86,7 @@ function aggregator_settings() {
$output .= form_select(t('Items shown in sources and categories pages'), 'aggregator_summary_items', variable_get('aggregator_summary_items', 3), $items, t('The number of items which will be shown with each feed or category in the feed and category summary pages.'));
$output .= form_radios(t('Category selection type'), 'aggregator_category_selector', variable_get('aggregator_category_selector', 'check'), array('check' => t('checkboxes'), 'select' => t('multiple selector')), t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.'));
return $output;
print theme('page', system_settings_form($output));
}
/**
......@@ -102,43 +103,91 @@ function aggregator_link($type) {
if ($type == 'page' && user_access('access news feeds')) {
return array(l(t('news feeds'), 'aggregator', array('title' => t('Read the latest news from syndicated web sites.'))));
}
}
if ($type == 'system') {
$access = user_access('administer news feeds');
menu('admin/aggregator', t('aggregator'), $access ? 'aggregator_admin_overview' : MENU_DENIED);
menu('admin/aggregator/add/feed', t('new feed'), $access ? 'aggregator_admin_edit_feed' : MENU_DENIED, 2);
menu('admin/aggregator/edit/feed', t('edit feed'), $access ? 'aggregator_admin_edit_feed' : MENU_DENIED, 2, MENU_HIDE);
menu('admin/aggregator/add/category', t('new category'), $access ? 'aggregator_admin_edit_category' : MENU_DENIED, 3);
menu('admin/aggregator/edit/category', t('edit category'), $access ? 'aggregator_admin_edit_category' : MENU_DENIED, 3, MENU_HIDE);
menu('admin/aggregator/remove', t('remove items'), $access ? 'aggregator_admin_remove_feed' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
menu('admin/aggregator/update', t('update items'), $access ? 'aggregator_admin_refresh_feed' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
menu('admin/aggregator/help', t('help'), $access ? 'aggregator_help_page' : MENU_DENIED, 9);
$access = user_access('access news feeds');
menu('aggregator', t('news aggregator'), $access ? 'aggregator_page_last' : MENU_DENIED, 5);
menu('aggregator/sources', t('sources'), $access ? 'aggregator_page_sources' : MENU_DENIED, 0);
menu('aggregator/categories', t('categories'), $access ? 'aggregator_page_categories' : MENU_DENIED, 1, MENU_HIDE_NOCHILD);
// To reduce the number of SQL queries, we don't query the database when
// not on an aggregator page.
// If caching of the menu is implemented, this check should be removed
// so that DHTML menu presentation can be used correctly.
if (arg(0) == 'aggregator') {
// Sources:
$result = db_query('SELECT title, fid FROM {aggregator_feed} ORDER BY title');
while ($feed = db_fetch_object($result)) {
menu('aggregator/sources/'. $feed->fid, $feed->title, $access ? 'aggregator_page_source' : MENU_DENIED);
}
/**
* Implementation of hook_menu().
*/
function aggregator_menu() {
$items = array();
// Categories:
$result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title');
while ($category = db_fetch_object($result)) {
menu('aggregator/categories/'. $category->cid, $category->title, $access ? 'aggregator_page_category' : MENU_DENIED);
}
$edit = user_access('administer news feeds');
$view = user_access('access news feeds');
$items[] = array('path' => 'admin/aggregator', 'title' => t('aggregator'),
'callback' => 'aggregator_admin_overview', 'access' => $edit);
$items[] = array('path' => 'admin/aggregator/edit/feed', 'title' => t('edit feed'),
'callback' => 'aggregator_admin_edit_feed', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/edit/category', 'title' => t('edit category'),
'callback' => 'aggregator_admin_edit_category', 'access' => $edit,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/aggregator/remove', 'title' => t('remove items'),
'callback' => 'aggregator_admin_remove_feed', 'access' => $edit,
'type' => MENU_CALLBACK);