Commit 7ce686c1 authored by Dries's avatar Dries

o Permission improvements:

   + Removed the "post content" permission and replaced it by more fine-grained permissions such as "maintain static pages", "maintain personal blog", "maintain stories", etc.

o Usability improvements to teasers:

   + Teaser forms are no more.  Teasers are extracted automatically but can also be instructed using a delimiter "---".  Furthermore, when a post it too short for a teaser, the user won't be bother with teaser stuff anymore.

   + Added an option to set the teaser length, or to disable teasers all together.

   + When previewing a post, both the short (if any) and the full version of a post are shown.  This addresses a common complaint; for example, when writing a book page there was no way you could preview the short version of your post.

   + Forum posts can be teasered now.  This is particularly helpful in the context of drupal.org where we promote forum topics.

o Bugfix: replaced all PHP short tags (<?) with long tags (<?php).

o Bugfix: removed hard-coded dependence on comment module.

o Bugfix: when the queue module was disabled, it was not possible to approve updated book pages.

o Bugfix: applied modified version of Marco's node_teaser() fix.
parent eceead18
Drupal x.x.x, 2002-xx-xx Drupal x.x.x, xxxx-xx-xx (to be released)
------------------------
- node system improvements:
* replaced the "post content" permission by more fine-grained permissions.
* improved content submission:
+ improved teasers: teasers are now optional, teaser length can be configured, teaser and body are edited in a single textarea, users will no longer be bother with teasers when the post is too short for a teaser.
+ added the ability to preview both the short and the full version of your posts.
Drupal 4.1.0, xxxx-xx-xx (to be released)
------------------------ ------------------------
- collaboratively revised and expanded the Drupal documentation. - collaboratively revised and expanded the Drupal documentation.
...@@ -21,6 +30,7 @@ Drupal x.x.x, 2002-xx-xx ...@@ -21,6 +30,7 @@ Drupal x.x.x, 2002-xx-xx
- replaced weblogs.module by ping.module: - replaced weblogs.module by ping.module:
* added support for normal and RSS notifications of http://blo.gs/. * added support for normal and RSS notifications of http://blo.gs/.
* added support for RSS ping-notifications of http://weblogs.com/. * added support for RSS ping-notifications of http://weblogs.com/.
- removed the rating module
- themes: - themes:
* removed a significant portion of hard-coded mark-up. * removed a significant portion of hard-coded mark-up.
...@@ -53,7 +63,7 @@ Drupal 4.0.0, 2002-06-15 ...@@ -53,7 +63,7 @@ Drupal 4.0.0, 2002-06-15
* blocks can now be enabled and/or be set by the user. * blocks can now be enabled and/or be set by the user.
* blocks can be set to only show up on some pages. * blocks can be set to only show up on some pages.
* merged box module with block module. * merged box module with block module.
- rewrote large parts of the node system: - node system improvements:
* fixed node retrieval based on titles. * fixed node retrieval based on titles.
* blogs can be updated. * blogs can be updated.
* teasers (abstracts) on all node types. * teasers (abstracts) on all node types.
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# PHP settings: # PHP settings:
# #
# To see what PHP settings are known to work well, take a look at # To see what PHP settings are known to work well, take a look at
# the .htacesss file in Drupal's root directory. If you get # the .htacesss file in Drupal's root directory. If you get
# unexecpted warnings or errors, double-check your PHP settings. # unexecpted warnings or errors, double-check your PHP settings.
# If required, update PHP's include path to include your PEAR directory: # If required, update PHP's include path to include your PEAR directory:
......
...@@ -57,7 +57,7 @@ function import_update() { ...@@ -57,7 +57,7 @@ function import_update() {
function import_format_item($item, $feed = 0) { function import_format_item($item, $feed = 0) {
global $theme, $user; global $theme, $user;
if ($user->uid && user_access("post content")) { if ($user->uid && user_access("maintain personal blog")) {
$output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog."))); $output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
} }
...@@ -568,7 +568,7 @@ function import_page_last() { ...@@ -568,7 +568,7 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">"; $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("post content")) { if (module_exist("blog") && user_access("maintain personal blog")) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog."))); $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
} }
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed."))); $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
...@@ -604,7 +604,7 @@ function import_page_feed($fid) { ...@@ -604,7 +604,7 @@ function import_page_feed($fid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">"; $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("post content")) { if (module_exist("blog") && user_access("maintain personal blog")) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog."))); $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
} }
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>"; $links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
...@@ -641,7 +641,7 @@ function import_page_bundle($bid) { ...@@ -641,7 +641,7 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">"; $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("post content")) { if (module_exist("blog") && user_access("maintain personal blog")) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog."))); $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
} }
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed."))); $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
......
...@@ -57,7 +57,7 @@ function import_update() { ...@@ -57,7 +57,7 @@ function import_update() {
function import_format_item($item, $feed = 0) { function import_format_item($item, $feed = 0) {
global $theme, $user; global $theme, $user;
if ($user->uid && user_access("post content")) { if ($user->uid && user_access("maintain personal blog")) {
$output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog."))); $output .= lm("<img src=\"". $theme->image("blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
} }
...@@ -568,7 +568,7 @@ function import_page_last() { ...@@ -568,7 +568,7 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">"; $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("post content")) { if (module_exist("blog") && user_access("maintain personal blog")) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog."))); $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
} }
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed."))); $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
...@@ -604,7 +604,7 @@ function import_page_feed($fid) { ...@@ -604,7 +604,7 @@ function import_page_feed($fid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">"; $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("post content")) { if (module_exist("blog") && user_access("maintain personal blog")) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog."))); $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
} }
$links[] = "<a href=\"$item->link\">". t("visit") ."</a>"; $links[] = "<a href=\"$item->link\">". t("visit") ."</a>";
...@@ -641,7 +641,7 @@ function import_page_bundle($bid) { ...@@ -641,7 +641,7 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">"; $output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
if (module_exist("blog") && user_access("post content")) { if (module_exist("blog") && user_access("maintain personal blog")) {
$links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog."))); $links[] = lm(t("blog it"), array("mod" => "node", "op" => "add", "type" => "blog", "iid" => $item->iid), "", array("title" => t("Comment on this news item in your personal blog.")));
} }
$links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed."))); $links[] = lm(t("feed"), array("mod" => "import", "op" => "feed", "id" => $item->fid), "", array("title" => t("Read more syndicated news from this feed.")));
......
...@@ -22,6 +22,10 @@ function blog_node($field) { ...@@ -22,6 +22,10 @@ function blog_node($field) {
return $info[$field]; return $info[$field];
} }
function blog_perm() {
return array("maintain personal blog");
}
function blog_access($op, $node) { function blog_access($op, $node) {
global $user; global $user;
...@@ -30,15 +34,15 @@ function blog_access($op, $node) { ...@@ -30,15 +34,15 @@ function blog_access($op, $node) {
} }
if ($op == "create") { if ($op == "create") {
return $user->uid; return user_access("maintain personal blog") && $user->uid;
} }
if ($op == "update") { if ($op == "update") {
return ($user->uid == $node->uid); return user_access("maintain personal blog") && ($user->uid == $node->uid);
} }
if ($op == "delete") { if ($op == "delete") {
return ($user->uid == $node->uid); return user_access("maintain personal blog") && ($user->uid == $node->uid);
} }
} }
...@@ -68,10 +72,15 @@ function blog_save($op, $node) { ...@@ -68,10 +72,15 @@ function blog_save($op, $node) {
if ($op == "create") { if ($op == "create") {
if (user_access("administer nodes")) { if (user_access("administer nodes")) {
return array("body" => filter($node->body), "teaser" => filter($node->teaser)); /*
** When an administrator creates blog entries through the admin
** pages, they will not be changed unless explicitly specified.
*/
return array();
} }
else { else {
return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "status" => 1, "teaser" => filter($node->teaser)); return array("promote" => 0, "moderate" => 1, "status" => 1);
} }
} }
...@@ -86,7 +95,7 @@ function blog_save($op, $node) { ...@@ -86,7 +95,7 @@ function blog_save($op, $node) {
** pages, they will not be changed unless explicitly specified. ** pages, they will not be changed unless explicitly specified.
*/ */
return array("body" => filter($node->body), "teaser" => filter($node->teaser)); return array();
} }
else { else {
/* /*
...@@ -94,7 +103,7 @@ function blog_save($op, $node) { ...@@ -94,7 +103,7 @@ function blog_save($op, $node) {
** and will queue it in the moderation queue for promotion. ** and will queue it in the moderation queue for promotion.
*/ */
return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "score" => 0, "teaser" => filter($node->teaser), "votes" => 0, "users" => 0); return array("promote" => 0, "moderate" => 1, "score" => 0, "votes" => 0, "users" => 0);
} }
} }
...@@ -205,10 +214,6 @@ function blog_form(&$node, &$help, &$error) { ...@@ -205,10 +214,6 @@ function blog_form(&$node, &$help, &$error) {
} }
} }
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
if (function_exists("taxonomy_node_form")) { if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("blog", $node)); $output .= implode("", taxonomy_node_form("blog", $node));
} }
...@@ -260,11 +265,11 @@ function blog_link($type, $node = 0, $main) { ...@@ -260,11 +265,11 @@ function blog_link($type, $node = 0, $main) {
$links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))); $links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries.")));
} }
if ($type == "menu.create" && user_access("post content")) { if ($type == "menu.create" && user_access("maintain personal blog")) {
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry."))); $links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry.")));
} }
if ($type == "menu.view" && user_access("access content")) { if ($type == "menu.view" && user_access("maintain personal blog")) {
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries."))); $links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries.")));
} }
......
...@@ -22,6 +22,10 @@ function blog_node($field) { ...@@ -22,6 +22,10 @@ function blog_node($field) {
return $info[$field]; return $info[$field];
} }
function blog_perm() {
return array("maintain personal blog");
}
function blog_access($op, $node) { function blog_access($op, $node) {
global $user; global $user;
...@@ -30,15 +34,15 @@ function blog_access($op, $node) { ...@@ -30,15 +34,15 @@ function blog_access($op, $node) {
} }
if ($op == "create") { if ($op == "create") {
return $user->uid; return user_access("maintain personal blog") && $user->uid;
} }
if ($op == "update") { if ($op == "update") {
return ($user->uid == $node->uid); return user_access("maintain personal blog") && ($user->uid == $node->uid);
} }
if ($op == "delete") { if ($op == "delete") {
return ($user->uid == $node->uid); return user_access("maintain personal blog") && ($user->uid == $node->uid);
} }
} }
...@@ -68,10 +72,15 @@ function blog_save($op, $node) { ...@@ -68,10 +72,15 @@ function blog_save($op, $node) {
if ($op == "create") { if ($op == "create") {
if (user_access("administer nodes")) { if (user_access("administer nodes")) {
return array("body" => filter($node->body), "teaser" => filter($node->teaser)); /*
** When an administrator creates blog entries through the admin
** pages, they will not be changed unless explicitly specified.
*/
return array();
} }
else { else {
return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "status" => 1, "teaser" => filter($node->teaser)); return array("promote" => 0, "moderate" => 1, "status" => 1);
} }
} }
...@@ -86,7 +95,7 @@ function blog_save($op, $node) { ...@@ -86,7 +95,7 @@ function blog_save($op, $node) {
** pages, they will not be changed unless explicitly specified. ** pages, they will not be changed unless explicitly specified.
*/ */
return array("body" => filter($node->body), "teaser" => filter($node->teaser)); return array();
} }
else { else {
/* /*
...@@ -94,7 +103,7 @@ function blog_save($op, $node) { ...@@ -94,7 +103,7 @@ function blog_save($op, $node) {
** and will queue it in the moderation queue for promotion. ** and will queue it in the moderation queue for promotion.
*/ */
return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "score" => 0, "teaser" => filter($node->teaser), "votes" => 0, "users" => 0); return array("promote" => 0, "moderate" => 1, "score" => 0, "votes" => 0, "users" => 0);
} }
} }
...@@ -205,10 +214,6 @@ function blog_form(&$node, &$help, &$error) { ...@@ -205,10 +214,6 @@ function blog_form(&$node, &$help, &$error) {
} }
} }
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
if (function_exists("taxonomy_node_form")) { if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("blog", $node)); $output .= implode("", taxonomy_node_form("blog", $node));
} }
...@@ -260,11 +265,11 @@ function blog_link($type, $node = 0, $main) { ...@@ -260,11 +265,11 @@ function blog_link($type, $node = 0, $main) {
$links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries."))); $links[] = lm(t("user blogs"), array("mod" => "blog"), "", array("title" => t("Read the latest blog entries.")));
} }
if ($type == "menu.create" && user_access("post content")) { if ($type == "menu.create" && user_access("maintain personal blog")) {
$links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry."))); $links[] = lm(t("create blog entry"), array("mod" => "node", "op" => "add", "type" => "blog"), "", array("title" => t("Add a new personal blog entry.")));
} }
if ($type == "menu.view" && user_access("access content")) { if ($type == "menu.view" && user_access("maintain personal blog")) {
$links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries."))); $links[] = lm(t("view personal blog"), array("mod" => "blog", "op" => "view", "id" => $user->uid), "", array("title" => t("Read your latest blog entries.")));
} }
......
...@@ -156,62 +156,59 @@ function bloggerapi_driver($method, $params = 0, $error = 0) { ...@@ -156,62 +156,59 @@ function bloggerapi_driver($method, $params = 0, $error = 0) {
} }
if ($user->uid && user_access("access Blogger API")) { if ($user->uid && user_access("access Blogger API")) {
if (user_access("post content")) {
/* /*
** Check for title tags, if not generate one. ** Check for title tags, if not generate one.
*/ */
if (eregi("<title>(.*)</title>", $cparams[4], $title)) { if (eregi("<title>(.*)</title>", $cparams[4], $title)) {
$title = strip_tags($title[0]); $title = strip_tags($title[0]);
$cparams[4] = ereg_replace("<title>.*</title>", "", $cparams[4]); $cparams[4] = ereg_replace("<title>.*</title>", "", $cparams[4]);
} }
else { else {
$title = bloggerapi_title($cparams[4]); $title = bloggerapi_title($cparams[4]);
} }
$teaser = node_teaser($cparams[4]);
/*
** Maps params to node array or call another function
*/
switch ($method) { /*
case "newPost": ** Maps params to node array or call another function
return array("type" => "blog", "title" => $title, "teaser" => $teaser, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0); */
break;
case "editPost": switch ($method) {
$node = node_load(array("nid" => $cparams[1])); case "newPost":
if ($node->uid == $user->uid) { return array("type" => "blog", "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0);
return array("nid" => $cparams[1], "type" => "blog", "title" => $title, "teaser" => $teaser, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0); break;
} case "editPost":
else { $node = node_load(array("nid" => $cparams[1]));
return bloggerapi_error("Error updating node"); if ($node->uid == $user->uid) {
} return array("nid" => $cparams[1], "type" => "blog", "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0);
break; }
case "getUsersBlogs": else {
return bloggerapi_user_blogs(); return bloggerapi_error("Error updating node");
break; }
case "getUserInfo": break;
return bloggerapi_user_info(); case "getUsersBlogs":
break; return bloggerapi_user_blogs();
case "getPost": break;
return bloggerapi_node_load($cparams[1]); case "getUserInfo":
break; return bloggerapi_user_info();
case "getRecentPosts": break;
return bloggerapi_node_recent($cparams[4]); case "getPost":
break; return bloggerapi_node_load($cparams[1]);
case "deletePost": break;
return bloggerapi_node_delete($cparams[1]); case "getRecentPosts":
break; return bloggerapi_node_recent($cparams[4]);
case "distribute": break;
break; case "deletePost":
default: return bloggerapi_node_delete($cparams[1]);
return bloggerapi_error("Error in the authentication process"); break;
break; case "distribute":
} break;
default:
return bloggerapi_error("Error in the authentication process");
break;
} }
} else { }
else {
return bloggerapi_error("Error in the authentication process"); return bloggerapi_error("Error in the authentication process");
} }
} }
...@@ -381,7 +378,7 @@ function bloggerapi_help() { ...@@ -381,7 +378,7 @@ function bloggerapi_help() {
<h3>Introduction</h3> <h3>Introduction</h3>
<p><a href="http://www.blogger.com">Blogger</a>, the well-known public weblog service, provides an application programing interface (API) to allow remote procedure calls (RPC) to the Blogger service. Drupal supports this <a href="http://plant.blogger.com/api/index.html">Blogger API</a>, which means that many remote clients (e.g. <a href="radio.userland.com">Radio</a>, <a href="http://simon.kittle.info/textrouter">TextRouter</a>, <a href="http://blogbuddy.sourceforge.net/">Blogbuddy</a>, <a href="http://www.wbloggar.com/">w.bloggar</a>, <a href="http://www.tswoam.co.uk/index.php?n_go=16">PerlyBlog</a>), may post to Drupal. These clients provide a bevy of interesting capabilities like offline composing, spellcheck, and WYSIWYG editing; many folks prefer to blog with a client application over typical web forms. By supporting the Blogger API, Drupal grows grander than a web site engine, it's a <i>content accepting machine</i>&trade;. <p><a href="http://www.blogger.com">Blogger</a>, the well-known public weblog service, provides an application programing interface (API) to allow remote procedure calls (RPC) to the Blogger service. Drupal supports this <a href="http://plant.blogger.com/api/index.html">Blogger API</a>, which means that many remote clients (e.g. <a href="radio.userland.com">Radio</a>, <a href="http://simon.kittle.info/textrouter">TextRouter</a>, <a href="http://blogbuddy.sourceforge.net/">Blogbuddy</a>, <a href="http://www.wbloggar.com/">w.bloggar</a>, <a href="http://www.tswoam.co.uk/index.php?n_go=16">PerlyBlog</a>), may post to Drupal. These clients provide a bevy of interesting capabilities like offline composing, spellcheck, and WYSIWYG editing; many folks prefer to blog with a client application over typical web forms. By supporting the Blogger API, Drupal grows grander than a web site engine, it's a <i>content accepting machine</i>&trade;.
<p>The <a href="http://plant.blogger.com/api/index.html">Blogger RPC API</a> uses the <a href="http://www.xmlrpc.com">XML-RPC</a> protocol for communicating with the outside world. XML-RPC, originally developed by Dave Winer of <a href="http://www.userland.com">UserLand Software</a>, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses XML-RPC for several other tasks (e.g. notifiying <a href="http://www.weblogs.com">weblogs.com</a> of blog updates and making/accepting <? echo lm("Distributed Authentication", array("mod" => "user", "op" => "help")) ?> requests)</p> <p>The <a href="http://plant.blogger.com/api/index.html">Blogger RPC API</a> uses the <a href="http://www.xmlrpc.com">XML-RPC</a> protocol for communicating with the outside world. XML-RPC, originally developed by Dave Winer of <a href="http://www.userland.com">UserLand Software</a>, is a simple XML-based RPC specification ideally suited to the web. Drupal also uses XML-RPC for several other tasks (e.g. notifiying <a href="http://www.weblogs.com">weblogs.com</a> of blog updates and making/accepting <?php echo lm("Distributed Authentication", array("mod" => "user", "op" => "help")) ?> requests)</p>
<h3>Blogger API implementation</h3> <h3>Blogger API implementation</h3>
...@@ -404,7 +401,7 @@ function bloggerapi_help() { ...@@ -404,7 +401,7 @@ function bloggerapi_help() {
<h3>Installation and usage</h3> <h3>Installation and usage</h3>
<p>To install the Blogger API module, enable the module in the <i>site configuration - modules</i> tab in the administration pages. Also make sure you have your permissions set correctly for accessing the Blogger API, the relevant settings can be found under the <i>user management</i> tab in the administration menu. Check the checkbox behind the line "access Blogger API" for the roles that are allowed to use the Blogger API. Make sure those roles have the right to "post content" as well.</p> <p>To install the Blogger API module, enable the module in the <i>site configuration - modules</i> tab in the administration pages. Also make sure you have your permissions set correctly for accessing the Blogger API, the relevant settings can be found under the <i>user management</i> tab in the administration menu. Check the checkbox behind the line "access Blogger API" for the roles that are allowed to use the Blogger API.</p>
<p>Once the API is enabled you can download one of the above mentioned Blogger API clients and get blogging.</p> <p>Once the API is enabled you can download one of the above mentioned Blogger API clients and get blogging.</p>
<h3>Setup of the client</h3> <h3>Setup of the client</h3>
......
...@@ -15,6 +15,10 @@ function book_node($field) { ...@@ -15,6 +15,10 @@ function book_node($field) {
return $info[$field]; return $info[$field];
} }
function book_perm() {
return array("maintain books");
}
function book_access($op, $node) { function book_access($op, $node) {
global $user; global $user;
...@@ -35,7 +39,7 @@ function book_access($op, $node) { ...@@ -35,7 +39,7 @@ function book_access($op, $node) {
** of the book module this is considered to be a good/safe idea. ** of the book module this is considered to be a good/safe idea.
*/ */
return $user->uid; return user_access("maintain books");
} }
if ($op == "update") { if ($op == "update") {
...@@ -49,7 +53,7 @@ function book_access($op, $node) { ...@@ -49,7 +53,7 @@ function book_access($op, $node) {
** are allowed. ** are allowed.
*/ */
return $user->uid && !$node->moderate && !$node->format && $node->revision; return user_access("maintain books") && !$node->moderate && !$node->format && $node->revision;
} }
} }
...@@ -62,10 +66,10 @@ function book_save($op, $node) { ...@@ -62,10 +66,10 @@ function book_save($op, $node) {
if ($op == "create") { if ($op == "create") {
if (user_access("administer nodes")) { if (user_access("administer nodes")) {
return array("body" => filter($node->body), "teaser" => filter($node->teaser), "format", "parent", "weight", "log"); return array("teaser" => $node->body, "format", "parent", "weight", "log");
} }
else { else {
return array("body" => filter($node->body), "teaser" => filter($node->teaser), "format", "moderate" => 1, "parent", "promote" => 0, "status" => 1, "weight", "log"); return array("teaser" => $node->body, "format", "moderate" => 1, "parent", "promote" => 0, "status" => 1, "weight", "log");
} }
} }
...@@ -80,7 +84,7 @@ function book_save($op, $node) { ...@@ -80,7 +84,7 @@ function book_save($op, $node) {
** new revision unless we are explicitly instructed to. ** new revision unless we are explicitly instructed to.
*/ */
return array("body" => filter($node->body), "teaser" => filter($node->teaser), "format", "parent", "weight", "log"); return array("teaser" => $node->body, "format", "parent", "weight", "log");
} }
else { else {
/* /*
...@@ -89,7 +93,7 @@ function book_save($op, $node) { ...@@ -89,7 +93,7 @@ function book_save($op, $node) {
** and are not promoted by default. See also: book_load(). ** and are not promoted by default. See also: book_load().
*/ */
return array("body" => filter($node->body), "teaser" => filter($node->teaser), "created" => time(), "format", "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight", "log"); return array("teaser" => $node->body, "created" => time(), "format", "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight", "log");
} }
} }
...@@ -100,11 +104,11 @@ function book_link($type, $node = 0, $main = 0) { ...@@ -100,11 +104,11 @@ function book_link($type, $node = 0, $main = 0) {
$links[] = lm(t("collaborative book"), array("mod" => "book"), "", array("title" => t("Read and contribute to the collaborative books.")));