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;
}
/**
......
This diff is collapsed.
This diff is collapsed.
......@@ -6,15 +6,15 @@
*/
function archive_help($section) {
switch ($section) {
case 'admin/system/modules#description':
case 'admin/modules#description':
return t('Displays a calendar to navigate old content.');
case 'admin/system/modules/archive':
case 'admin/settings/archive':
return t('Choose the starting "day of the week" for the displayed calendar block.');
}
}
/**
* Generates a monthly claendar, for display in the archive block.
* Generates a monthly calendar, for display in the archive block.
*/
function archive_calendar($original = 0) {
global $user;
......@@ -199,14 +199,25 @@ function archive_link($type) {
if ($type == 'page' && user_access('access content')) {
$links[] = l(t('archives'), 'archive', array('title' => t('Read the older content in our archive.')));
}
if ($type == 'system') {
menu('archive', t('archives'), user_access('access content') ? 'archive_page' : MENU_DENIED, 0, MENU_HIDE);
}
return $links;
}
/**
* Implementation of hook_menu().
*/
function archive_menu() {
$items = array();
$items[] = array('path' => 'archive', 'title' => t('archives'),
'access' => user_access('access content'),
'callback' => 'archive_page',
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'archive/configure', 'title' => t('configure'),
'access' => user_access('administer site configuration'),
'callback' => 'archive_configure',
'type' => MENU_LOCAL_TASK);
return $items;
}
/**
* Menu callback; lists all nodes posted on a given date.
*/
......@@ -247,13 +258,14 @@ function archive_page($year = 0, $month = 0, $day = 0) {
print theme('page', $output);
}
/**
* Implementation of hook_settings().
*/
function archive_settings() {
function archive_configure() {
if ($_POST) {
system_settings_save();
}
$output = form_select(t('First day of week'), 'default_firstday', variable_get('default_firstday', 0), array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')), t('The first day of the week. By changing this value you choose how the calendar block is rendered.'));
return $output;
print theme('page', system_settings_form($output));
}
?>
......@@ -6,15 +6,15 @@
*/
function archive_help($section) {
switch ($section) {
case 'admin/system/modules#description':
case 'admin/modules#description':
return t('Displays a calendar to navigate old content.');
case 'admin/system/modules/archive':
case 'admin/settings/archive':
return t('Choose the starting "day of the week" for the displayed calendar block.');
}
}
/**
* Generates a monthly claendar, for display in the archive block.
* Generates a monthly calendar, for display in the archive block.
*/
function archive_calendar($original = 0) {
global $user;
......@@ -199,14 +199,25 @@ function archive_link($type) {
if ($type == 'page' && user_access('access content')) {
$links[] = l(t('archives'), 'archive', array('title' => t('Read the older content in our archive.')));
}
if ($type == 'system') {
menu('archive', t('archives'), user_access('access content') ? 'archive_page' : MENU_DENIED, 0, MENU_HIDE);
}
return $links;
}
/**
* Implementation of hook_menu().
*/
function archive_menu() {
$items = array();
$items[] = array('path' => 'archive', 'title' => t('archives'),
'access' => user_access('access content'),
'callback' => 'archive_page',
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'archive/configure', 'title' => t('configure'),
'access' => user_access('administer site configuration'),
'callback' => 'archive_configure',
'type' => MENU_LOCAL_TASK);
return $items;
}
/**
* Menu callback; lists all nodes posted on a given date.
*/
......@@ -247,13 +258,14 @@ function archive_page($year = 0, $month = 0, $day = 0) {
print theme('page', $output);
}
/**
* Implementation of hook_settings().
*/
function archive_settings() {
function archive_configure() {
if ($_POST) {
system_settings_save();
}
$output = form_select(t('First day of week'), 'default_firstday', variable_get('default_firstday', 0), array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')), t('The first day of the week. By changing this value you choose how the calendar block is rendered.'));
return $output;
print theme('page', system_settings_form($output));
}
?>
This diff is collapsed.
This diff is collapsed.
......@@ -68,9 +68,9 @@ function blog_help($section) {
<p>Blogs are made up of individual entries (nodes) that are timestamped and are typically viewed by day as you would a diary. Blogs often contain links to things you've seen and/or agree/disagree with. A typical example of a long term blog can be seen at %scripting-com.</p>
<p>The blog module adds a \"user blogs\" navigation link to the site, which takes any visitor to a page that displays the most recent blog entries from all the users on the site. Personal user menus gain a \"create a blog entry\" link (which takes you to a submission form) and a \"view personal blog\" link (which displays your blog entries as other people will see them). On the bottom of each of your own blog entries, there is an \"edit this blog entry\" link that lets you edit or delete that entry.</p>
<p>If a user has the ability to post blogs, then the import module (news aggregator) will display a blog-it link <strong>(b)</strong> next to each news item in its lists. Click on this and you will be taken to the blog submission form, with the title, a link to the item, and a link to the source into the body text already in the text box, ready for you to add your explanation. This actively encourages people to add blog entries about things they see and hear elsewhere in the Drupal site and from your syndicated partner sites.</p>", array('%scripting-com' => '<a href="http://www.scripting.com/">http://www.scripting.com/</a>'));
case 'admin/system/modules#description':
case 'admin/modules#description':
return t('Enables keeping a blog or easily and regularly updated web page.');
case 'admin/system/modules/blog':
case 'admin/settings/blog':
return t("A weblog is a running journal of a user's ideas. Enter the minimum word count for a single entry, and the text displayed on the entry submission form");
case 'node/add/blog':
return variable_get('blog_help', '');
......@@ -201,7 +201,7 @@ function blog_form(&$node, &$error) {
*/
if ($nid && $blog = node_load(array('nid' => $nid))) {
$node->body = '<i>'. $blog->body .'</i> ['. l($blog->name, "node/view/$nid") .']';
$node->body = '<i>'. $blog->body .'</i> ['. l($blog->name, "node/$nid") .']';
}
if ($iid && $item = db_fetch_object(db_query('SELECT i.*, f.title as ftitle, f.link as flink FROM {aggregator_item} i, {aggregator_feed} f WHERE i.iid = %d AND i.fid = f.fid', $iid))) {
......@@ -222,50 +222,40 @@ function blog_form(&$node, &$error) {
/**
* Implementation of hook_content().
*/
function blog_content($node, $main = 0) {
return node_prepare($node, $main);
function blog_content($node, $teaser = FALSE) {
return node_prepare($node, $teaser);
}
/**
* Implementation of hook_view().
*/
function blog_view($node, $main = 0, $page = 0) {
function blog_view($node, $teaser = FALSE, $page = FALSE) {
if ($page) {
// Breadcrumb navigation
$breadcrumb[] = l(t('Home'), '');
$breadcrumb[] = l(t('blogs'), 'blog');
$breadcrumb[] = l(t("%name's blog", array('%name' => $node->name)), "blog/$node->uid");
// set the breadcrumb
drupal_set_breadcrumb($breadcrumb);
$breadcrumb[] = array('path' => 'blog', 'title' => t('blogs'));
$breadcrumb[] = array('path' => 'blog/'. $node->uid, 'title' => t("%name's blog", array('%name' => $node->name)));
$breadcrumb[] = array('path' => 'node/'. $node->nid);
menu_set_location($breadcrumb);
}
// prepare the node content
$node = blog_content($node, $main);
$node = blog_content($node, $teaser);
// print the node
return theme('node', $node, $main, $page);
return theme('node', $node, $teaser, $page);
}
/**
* Implementation of hook_link().
*/
function blog_link($type, $node = 0, $main) {
global $user;
$links = array();
if ($type == 'system') {
menu('node/add/blog', t('blog entry'), user_access('maintain personal blog') ? MENU_FALLTHROUGH : MENU_DENIED, 0);
menu('blog/'. $user->uid, t('my blog'), MENU_FALLTHROUGH, 1, MENU_SHOW, MENU_LOCKED);
menu('blog', t('blogs'), user_access('access content') ? 'blog_page' : MENU_DENIED, 0, MENU_HIDE);
menu('blog/feed', t('RSS feed'), user_access('access content') ? 'blog_feed' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
}
if ($type == 'page' && user_access('access content')) {
$links[] = l(t('blogs'), 'blog', array('title' => t('Read the latest blog entries.')));
}
if ($type == 'node' && $node->type == 'blog') {
if (blog_access('update', $node)) {
$links[] = l(t('edit this blog entry'), "node/edit/$node->nid", array('title' => t('Edit this blog entry.')));
$links[] = l(t('edit this blog entry'), "node/$node->nid/edit", array('title' => t('Edit this blog entry.')));
}
elseif (arg(0) != 'blog' && arg(1) != $node->uid) {
$links[] = l(t("%username's blog", array('%username' => $node->name)), "blog/$node->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $node->name))));
......@@ -275,6 +265,29 @@ function blog_link($type, $node = 0, $main) {
return $links;
}
/**
* Implementation of hook_menu().
*/
function blog_menu() {
global $user;
$items = array();
$items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
'access' => user_access('maintain personal blog'));
$items[] = array('path' => 'blog', 'title' => t('blogs'),
'callback' => 'blog_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'blog/'. $user->uid, 'title' => t('my blog'),
'access' => user_access('maintain personal blog'),
'type' => MENU_DYNAMIC_ITEM);
$items[] = array('path' => 'blog/feed', 'title' => t('RSS feed'),
'callback' => 'blog_feed',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
return $items;
}
/**
* Implementation of hook_block().
*
......
......@@ -68,9 +68,9 @@ function blog_help($section) {
<p>Blogs are made up of individual entries (nodes) that are timestamped and are typically viewed by day as you would a diary. Blogs often contain links to things you've seen and/or agree/disagree with. A typical example of a long term blog can be seen at %scripting-com.</p>
<p>The blog module adds a \"user blogs\" navigation link to the site, which takes any visitor to a page that displays the most recent blog entries from all the users on the site. Personal user menus gain a \"create a blog entry\" link (which takes you to a submission form) and a \"view personal blog\" link (which displays your blog entries as other people will see them). On the bottom of each of your own blog entries, there is an \"edit this blog entry\" link that lets you edit or delete that entry.</p>
<p>If a user has the ability to post blogs, then the import module (news aggregator) will display a blog-it link <strong>(b)</strong> next to each news item in its lists. Click on this and you will be taken to the blog submission form, with the title, a link to the item, and a link to the source into the body text already in the text box, ready for you to add your explanation. This actively encourages people to add blog entries about things they see and hear elsewhere in the Drupal site and from your syndicated partner sites.</p>", array('%scripting-com' => '<a href="http://www.scripting.com/">http://www.scripting.com/</a>'));
case 'admin/system/modules#description':
case 'admin/modules#description':
return t('Enables keeping a blog or easily and regularly updated web page.');
case 'admin/system/modules/blog':
case 'admin/settings/blog':
return t("A weblog is a running journal of a user's ideas. Enter the minimum word count for a single entry, and the text displayed on the entry submission form");
case 'node/add/blog':
return variable_get('blog_help', '');
......@@ -201,7 +201,7 @@ function blog_form(&$node, &$error) {
*/
if ($nid && $blog = node_load(array('nid' => $nid))) {
$node->body = '<i>'. $blog->body .'</i> ['. l($blog->name, "node/view/$nid") .']';
$node->body = '<i>'. $blog->body .'</i> ['. l($blog->name, "node/$nid") .']';
}
if ($iid && $item = db_fetch_object(db_query('SELECT i.*, f.title as ftitle, f.link as flink FROM {aggregator_item} i, {aggregator_feed} f WHERE i.iid = %d AND i.fid = f.fid', $iid))) {
......@@ -222,50 +222,40 @@ function blog_form(&$node, &$error) {
/**
* Implementation of hook_content().
*/
function blog_content($node, $main = 0) {
return node_prepare($node, $main);
function blog_content($node, $teaser = FALSE) {
return node_prepare($node, $teaser);
}
/**
* Implementation of hook_view().
*/
function blog_view($node, $main = 0, $page = 0) {
function blog_view($node, $teaser = FALSE, $page = FALSE) {
if ($page) {
// Breadcrumb navigation
$breadcrumb[] = l(t('Home'), '');
$breadcrumb[] = l(t('blogs'), 'blog');
$breadcrumb[] = l(t("%name's blog", array('%name' => $node->name)), "blog/$node->uid");
// set the breadcrumb
drupal_set_breadcrumb($breadcrumb);
$breadcrumb[] = array('path' => 'blog', 'title' => t('blogs'));
$breadcrumb[] = array('path' => 'blog/'. $node->uid, 'title' => t("%name's blog", array('%name' => $node->name)));
$breadcrumb[] = array('path' => 'node/'. $node->nid);
menu_set_location($breadcrumb);
}
// prepare the node content
$node = blog_content($node, $main);
$node = blog_content($node, $teaser);
// print the node
return theme('node', $node, $main, $page);
return theme('node', $node, $teaser, $page);
}
/**
* Implementation of hook_link().
*/
function blog_link($type, $node = 0, $main) {
global $user;
$links = array();
if ($type == 'system') {
menu('node/add/blog', t('blog entry'), user_access('maintain personal blog') ? MENU_FALLTHROUGH : MENU_DENIED, 0);
menu('blog/'. $user->uid, t('my blog'), MENU_FALLTHROUGH, 1, MENU_SHOW, MENU_LOCKED);
menu('blog', t('blogs'), user_access('access content') ? 'blog_page' : MENU_DENIED, 0, MENU_HIDE);
menu('blog/feed', t('RSS feed'), user_access('access content') ? 'blog_feed' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
}
if ($type == 'page' && user_access('access content')) {
$links[] = l(t('blogs'), 'blog', array('title' => t('Read the latest blog entries.')));
}
if ($type == 'node' && $node->type == 'blog') {
if (blog_access('update', $node)) {
$links[] = l(t('edit this blog entry'), "node/edit/$node->nid", array('title' => t('Edit this blog entry.')));
$links[] = l(t('edit this blog entry'), "node/$node->nid/edit", array('title' => t('Edit this blog entry.')));
}
elseif (arg(0) != 'blog' && arg(1) != $node->uid) {
$links[] = l(t("%username's blog", array('%username' => $node->name)), "blog/$node->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $node->name))));
......@@ -275,6 +265,29 @@ function blog_link($type, $node = 0, $main) {
return $links;
}
/**
* Implementation of hook_menu().
*/
function blog_menu() {
global $user;
$items = array();
$items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
'access' => user_access('maintain personal blog'));
$items[] = array('path' => 'blog', 'title' => t('blogs'),
'callback' => 'blog_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'blog/'. $user->uid, 'title' => t('my blog'),
'access' => user_access('maintain personal blog'),
'type' => MENU_DYNAMIC_ITEM);
$items[] = array('path' => 'blog/feed', 'title' => t('RSS feed'),
'callback' => 'blog_feed',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
return $items;
}
/**
* Implementation of hook_block().
*
......
......@@ -8,7 +8,7 @@ function blogapi_help($section) {
switch ($section) {
case 'admin/help#blogapi':
return t('This module adds support for several XML-RPC based blogging APIs. Specifically, it currently implements the %bloggerAPI, %metaweblogAPI, and most of the %moveabletype extensions. This allows users to contribute to drupal using external GUI applications, which can often offer richer functionality that online forms based editing', array('%bloggerAPI' => '<a href="http://www.blogger.com/developers/api/1_docs/">Blogger API</a>', '%metaweblogAPI' => '<a href="http://www.xmlrpc.com/metaWeblogApi">MetaWeblog API</a>', '%moveabletype' => '<a href="http://www.movabletype.org/docs/mtmanual_programmatic.html">Moveable Type API</a>'));
case 'admin/system/modules#description':
case 'admin/modules#description':
return t('Enable users to post using applications that support XML-RPC blog APIs');
}
}
......@@ -143,7 +143,7 @@ function blogapi_new_post($req_params) {
$nid = node_save($node);
if ($nid) {
watchdog('special', t('%node-type: added "%node-title" using blog API', array('%node-type' => t("$node->type"), '%node-title' => $node->title)), l(t('view post'), "node/view/$nid"));
watchdog('special', t('%node-type: added "%node-title" using blog API', array('%node-type' => t("$node->type"), '%node-title' => $node->title)), l(t('view post'), "node/$nid"));
return new xmlrpcresp(new xmlrpcval($nid, 'string'));
}
......@@ -203,7 +203,7 @@ function blogapi_edit_post($req_params) {
}
$nid = node_save($node);
if ($nid) {
watchdog('special', t('%node-type: updated "%node-title" using blog API', array('%node-type' => t("$node->type"), '%node-title' => $node->title)), l(t('view post'), "node/view/$nid"));
watchdog('special', t('%node-type: updated "%node-title" using blog API', array('%node-type' => t("$node->type"), '%node-title' => $node->title)), l(t('view post'), "node/$nid"));
return new xmlrpcresp(new xmlrpcval(true, 'boolean'));
}
......
......@@ -8,7 +8,7 @@ function blogapi_help($section) {
switch ($section) {
case 'admin/help#blogapi':
return t('This module adds support for several XML-RPC based blogging APIs. Specifically, it currently implements the %bloggerAPI, %metaweblogAPI, and most of the %moveabletype extensions. This allows users to contribute to drupal using external GUI applications, which can often offer richer functionality that online forms based editing', array('%bloggerAPI' => '<a href="http://www.blogger.com/developers/api/1_docs/">Blogger API</a>', '%metaweblogAPI' => '<a href="http://www.xmlrpc.com/metaWeblogApi">MetaWeblog API</a>', '%moveabletype' => '<a href="http://www.movabletype.org/docs/mtmanual_programmatic.html">Moveable Type API</a>'));
case 'admin/system/modules#description':
case 'admin/modules#description':
return t('Enable users to post using applications that support XML-RPC blog APIs');
}
}
......@@ -143,7 +143,7 @@ function blogapi_new_post($req_params) {
$nid = node_save($node);
if ($nid) {
watchdog('special', t('%node-type: added "%node-title" using blog API', array('%node-type' => t("$node->type"), '%node-title' => $node->title)), l(t('view post'), "node/view/$nid"));
watchdog('special', t('%node-type: added "%node-title" using blog API', array('%node-type' => t("$node->type"), '%node-title' => $node->title)), l(t('view post'), "node/$nid"));
return new xmlrpcresp(new xmlrpcval($nid, 'string'));
}
......@@ -203,7 +203,7 @@ function blogapi_edit_post($req_params) {
}
$nid = node_save($node);
if ($nid) {
watchdog('special', t('%node-type: updated "%node-title" using blog API', array('%node-type' => t("$node->type"), '%node-title' => $node->title)), l(t('view post'), "node/view/$nid"));
watchdog('special', t('%node-type: updated "%node-title" using blog API', array('%node-type' => t("$node->type"), '%node-title' => $node->title)), l(t('view post'), "node/$nid"));
return new xmlrpcresp(new xmlrpcval(true, 'boolean'));
}
......
......@@ -69,32 +69,52 @@ function book_link($type, $node = 0, $main = 0) {
if ($type == 'node' && $node->type == 'book') {
if (book_access('update', $node)) {
$links[] = l(t('edit this page'), "node/edit/$node->nid", array('title' => t('Suggest an update for this book page.')));
$links[] = l(t('edit this page'), "node/$node->nid/edit", array('title' => t('Suggest an update for this book page.')));
}
if (!$main) {
$links[] = l(t('printer-friendly version'), "book/print/$node->nid", array('title' => t('Show a printer-friendly version of this book page and its sub-pages.')));
}
}
if ($type == 'system') {
menu('node/add/book', t('book page'), user_access('maintain books') ? MENU_FALLTHROUGH : MENU_DENIED, 0);
menu('admin/node/book', t('books'), user_access('administer nodes') ? 'book_admin' : MENU_DENIED, 4);
menu('admin/node/book/orphan', t('orphan pages'), user_access('administer nodes') ? 'book_admin_orphan' : MENU_DENIED, 8);
menu('admin/node/book/help', t('help'), user_access('administer nodes') ? 'book_help_page' : MENU_DENIED, 9);
$result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title');
while ($book = db_fetch_object($result)) {
menu("admin/node/book/$book->nid", t('"%title" book', array('%title' => $book->title)), MENU_FALLTHROUGH);
}
menu('book', t('books'), user_access('access content') ? 'book_render' : MENU_DENIED, 0, MENU_HIDE);
menu('book/view', t('view'), user_access('access content') ? 'book_view_page' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
menu('book/print', t('printer-friendly version'), user_access('access content') ? 'book_print' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
}
return $links;
}
/**
* Implementation of hook_menu().
*/
function book_menu() {
$items = array();
$items[] = array('path' => 'node/add/book', 'title' => t('book page'),
'access' => user_access('maintain books'));
$items[] = array('path' => 'admin/node/book', 'title' => t('books'),
'callback' => 'book_admin',
'access' => user_access('administer nodes'),
'weight' => 4);
$items[] = array('path' => 'admin/node/book/orphan', 'title' => t('orphan pages'),
'callback' => 'book_admin_orphan',
'access' => user_access('administer nodes'),
'weight' => 8);
$result = db_query('SELECT n.nid, n.title FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title');
while ($book = db_fetch_object($result)) {
$items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title)));
}
$items[] = array('path' => 'book', 'title' => t('books'),
'callback' => 'book_render',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'book/view', 'title' => t('view'),
'callback' => 'book_view_page',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'book/print', 'title' => t('printer-friendly version'),
'callback' => 'book_print',
'access' => user_access('access content'),
'type' => MENU_CALLBACK);
return $items;
}
/**
* Implementation of hook_block().
*
......@@ -402,7 +422,7 @@ function book_next($node) {
/**
* Implementation of hook_content().
*/
function book_content($node, $main = 0) {
function book_content($node, $teaser = FALSE) {
$op = $_POST['op'];
/*
......@@ -436,7 +456,7 @@ function book_content($node, $main = 0) {
ob_end_clean();
}
else {
$node = node_prepare($node, $main);
$node = node_prepare($node, $teaser);
}
return $node;
......@@ -448,13 +468,13 @@ function book_content($node, $main = 0) {
* If not displayed on the main page, we render the node as a page in the