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.
......@@ -21,6 +30,7 @@ Drupal x.x.x, 2002-xx-xx
- replaced weblogs.module by ping.module:
* added support for normal and RSS notifications of http://blo.gs/.
* added support for RSS ping-notifications of http://weblogs.com/.
- removed the rating module
- themes:
* removed a significant portion of hard-coded mark-up.
......@@ -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 be set to only show up on some pages.
* merged box module with block module.
- rewrote large parts of the node system:
- node system improvements:
* fixed node retrieval based on titles.
* blogs can be updated.
* teasers (abstracts) on all node types.
......
......@@ -21,7 +21,7 @@
# PHP settings:
#
# 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.
# If required, update PHP's include path to include your PEAR directory:
......
......@@ -57,7 +57,7 @@ function import_update() {
function import_format_item($item, $feed = 0) {
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.")));
}
......@@ -568,7 +568,7 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
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("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) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
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[] = "<a href=\"$item->link\">". t("visit") ."</a>";
......@@ -641,7 +641,7 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
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("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() {
function import_format_item($item, $feed = 0) {
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.")));
}
......@@ -568,7 +568,7 @@ function import_page_last() {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
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("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) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
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[] = "<a href=\"$item->link\">". t("visit") ."</a>";
......@@ -641,7 +641,7 @@ function import_page_bundle($bid) {
$output .= "<table border=\"0\" cellpadding=\"4\" cellspacing=\"2\">";
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("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) {
return $info[$field];
}
function blog_perm() {
return array("maintain personal blog");
}
function blog_access($op, $node) {
global $user;
......@@ -30,15 +34,15 @@ function blog_access($op, $node) {
}
if ($op == "create") {
return $user->uid;
return user_access("maintain personal blog") && $user->uid;
}
if ($op == "update") {
return ($user->uid == $node->uid);
return user_access("maintain personal blog") && ($user->uid == $node->uid);
}
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) {
if ($op == "create") {
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 {
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) {
** pages, they will not be changed unless explicitly specified.
*/
return array("body" => filter($node->body), "teaser" => filter($node->teaser));
return array();
}
else {
/*
......@@ -94,7 +103,7 @@ function blog_save($op, $node) {
** 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) {
}
}
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("blog", $node));
}
......@@ -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.")));
}
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.")));
}
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.")));
}
......
......@@ -22,6 +22,10 @@ function blog_node($field) {
return $info[$field];
}
function blog_perm() {
return array("maintain personal blog");
}
function blog_access($op, $node) {
global $user;
......@@ -30,15 +34,15 @@ function blog_access($op, $node) {
}
if ($op == "create") {
return $user->uid;
return user_access("maintain personal blog") && $user->uid;
}
if ($op == "update") {
return ($user->uid == $node->uid);
return user_access("maintain personal blog") && ($user->uid == $node->uid);
}
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) {
if ($op == "create") {
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 {
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) {
** pages, they will not be changed unless explicitly specified.
*/
return array("body" => filter($node->body), "teaser" => filter($node->teaser));
return array();
}
else {
/*
......@@ -94,7 +103,7 @@ function blog_save($op, $node) {
** 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) {
}
}
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("blog", $node));
}
......@@ -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.")));
}
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.")));
}
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.")));
}
......
......@@ -156,62 +156,59 @@ function bloggerapi_driver($method, $params = 0, $error = 0) {
}
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)) {
$title = strip_tags($title[0]);
$cparams[4] = ereg_replace("<title>.*</title>", "", $cparams[4]);
}
else {
$title = bloggerapi_title($cparams[4]);
}
$teaser = node_teaser($cparams[4]);
/*
** Maps params to node array or call another function
*/
if (eregi("<title>(.*)</title>", $cparams[4], $title)) {
$title = strip_tags($title[0]);
$cparams[4] = ereg_replace("<title>.*</title>", "", $cparams[4]);
}
else {
$title = bloggerapi_title($cparams[4]);
}
switch ($method) {
case "newPost":
return array("type" => "blog", "title" => $title, "teaser" => $teaser, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0);
break;
case "editPost":
$node = node_load(array("nid" => $cparams[1]));
if ($node->uid == $user->uid) {
return array("nid" => $cparams[1], "type" => "blog", "title" => $title, "teaser" => $teaser, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0);
}
else {
return bloggerapi_error("Error updating node");
}
break;
case "getUsersBlogs":
return bloggerapi_user_blogs();
break;
case "getUserInfo":
return bloggerapi_user_info();
break;
case "getPost":
return bloggerapi_node_load($cparams[1]);
break;
case "getRecentPosts":
return bloggerapi_node_recent($cparams[4]);
break;
case "deletePost":
return bloggerapi_node_delete($cparams[1]);
break;
case "distribute":
break;
default:
return bloggerapi_error("Error in the authentication process");
break;
}
/*
** Maps params to node array or call another function
*/
switch ($method) {
case "newPost":
return array("type" => "blog", "title" => $title, "body" => $cparams[4], "status" => 1, "moderate" => 0, "comment" => 2, "promote" => 0, "revision" => 0);
break;
case "editPost":
$node = node_load(array("nid" => $cparams[1]));
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);
}
else {
return bloggerapi_error("Error updating node");
}
break;
case "getUsersBlogs":
return bloggerapi_user_blogs();
break;
case "getUserInfo":
return bloggerapi_user_info();
break;
case "getPost":
return bloggerapi_node_load($cparams[1]);
break;
case "getRecentPosts":
return bloggerapi_node_recent($cparams[4]);
break;
case "deletePost":
return bloggerapi_node_delete($cparams[1]);
break;
case "distribute":
break;
default:
return bloggerapi_error("Error in the authentication process");
break;
}
} else {
}
else {
return bloggerapi_error("Error in the authentication process");
}
}
......@@ -381,7 +378,7 @@ function bloggerapi_help() {
<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>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>
......@@ -404,7 +401,7 @@ function bloggerapi_help() {
<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>
<h3>Setup of the client</h3>
......
......@@ -15,6 +15,10 @@ function book_node($field) {
return $info[$field];
}
function book_perm() {
return array("maintain books");
}
function book_access($op, $node) {
global $user;
......@@ -35,7 +39,7 @@ function book_access($op, $node) {
** of the book module this is considered to be a good/safe idea.
*/
return $user->uid;
return user_access("maintain books");
}
if ($op == "update") {
......@@ -49,7 +53,7 @@ function book_access($op, $node) {
** 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) {
if ($op == "create") {
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 {
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) {
** 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 {
/*
......@@ -89,7 +93,7 @@ function book_save($op, $node) {
** 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) {
$links[] = lm(t("collaborative book"), array("mod" => "book"), "", array("title" => t("Read and contribute to the collaborative books.")));
}
if ($type == "menu.create" && user_access("post content")) {
if ($type == "menu.create" && user_access("maintain books")) {
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page.")));
}
if ($type == "admin" && user_access("administer nodes")) {
if ($type == "admin" && user_access("maintain books")) {
$links[] = la(t("collaborative book"), array("mod" => "book"));
}
......@@ -191,11 +195,6 @@ function book_form(&$node, &$help, &$error) {
$node->body = addslashes($node->body);
}
}
else {
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
}
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("book", $node));
......@@ -763,11 +762,11 @@ function book_help() {
<p>Book pages are a special, powerful node type. These nodes are specifically designed to be included in a book. Their special power comes from the bilility to embed PHP within the body of the page. This capability is only offerred to administrators, since malicious users could abuse this power. In addiiton, book pages contain a <i>log message</i> field which helps your users understand the motivation behind an edit of a book page. Each edited version of a book page is usually stored as a new revision of a node. This capability makes it easy to revert to an old version of a page, should that become desirable.</p>
<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
<p>Administrators may review the hierarchy of their books by clicking on the <? echo la("collaborative book link", array("mod" => "book")) ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes.
These nodes are now <i>orphans</i>. Administrators should periodically <? echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
<? echo la("export their books", array("mod" => "book", "op" => "print")) ?> to a single, flat HTML page which is suitable for printing.</p>
<p>Administrators may review the hierarchy of their books by clicking on the <?php echo la("collaborative book link", array("mod" => "book")) ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes.
These nodes are now <i>orphans</i>. Administrators should periodically <?php echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
<?php echo la("export their books", array("mod" => "book", "op" => "print")) ?> to a single, flat HTML page which is suitable for printing.</p>
<a name="faq"></a><h3>Maintain a FAQ using a collaborative book</i></h3>
......@@ -782,7 +781,7 @@ function book_help() {
<li>Any comments attached to those relevant posts which you designate as book pages will also be transported into your book. This is a great feature, since much wisdom is shared via comments. And remember that all future comments and edits will automatically be reflected in your book.</li>
<li>You may wish to edit the title and teaser of posts when adding them to your FAQ. This is done on the same page as the <i>Edit book outline</i> button. Clear titles help users navigate quickly to the information that they seek.</li>
<li>Book pages may come from any content type (blog, story, page, etc.). If you are creating a post solely for inclusion in your book, then use the <i>Create book page</i> link.</li>
<li>If you don't see the <i>administer</i> link, then you probably have insufficient <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
<li>If you don't see the <i>administer</i> link, then you probably have insufficient <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
<li>If you want to get really fancy, note that Books are one of the few content types which allow raw PHP in their <i>body</i>. So you've got lots of geeky possibilities there.</li>
</ul>
<?php
......
......@@ -15,6 +15,10 @@ function book_node($field) {
return $info[$field];
}
function book_perm() {
return array("maintain books");
}
function book_access($op, $node) {
global $user;
......@@ -35,7 +39,7 @@ function book_access($op, $node) {
** of the book module this is considered to be a good/safe idea.
*/
return $user->uid;
return user_access("maintain books");
}
if ($op == "update") {
......@@ -49,7 +53,7 @@ function book_access($op, $node) {
** 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) {
if ($op == "create") {
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 {
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) {
** 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 {
/*
......@@ -89,7 +93,7 @@ function book_save($op, $node) {
** 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) {
$links[] = lm(t("collaborative book"), array("mod" => "book"), "", array("title" => t("Read and contribute to the collaborative books.")));
}
if ($type == "menu.create" && user_access("post content")) {
if ($type == "menu.create" && user_access("maintain books")) {
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page.")));
}
if ($type == "admin" && user_access("administer nodes")) {
if ($type == "admin" && user_access("maintain books")) {
$links[] = la(t("collaborative book"), array("mod" => "book"));
}
......@@ -191,11 +195,6 @@ function book_form(&$node, &$help, &$error) {
$node->body = addslashes($node->body);
}
}
else {
if ($node->teaser) {
$output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
}
}
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("book", $node));
......@@ -763,11 +762,11 @@ function book_help() {
<p>Book pages are a special, powerful node type. These nodes are specifically designed to be included in a book. Their special power comes from the bilility to embed PHP within the body of the page. This capability is only offerred to administrators, since malicious users could abuse this power. In addiiton, book pages contain a <i>log message</i> field which helps your users understand the motivation behind an edit of a book page. Each edited version of a book page is usually stored as a new revision of a node. This capability makes it easy to revert to an old version of a page, should that become desirable.</p>
<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
<p>Administrators may review the hierarchy of their books by clicking on the <? echo la("collaborative book link", array("mod" => "book")) ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes.
These nodes are now <i>orphans</i>. Administrators should periodically <? echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
<? echo la("export their books", array("mod" => "book", "op" => "print")) ?> to a single, flat HTML page which is suitable for printing.</p>
<p>Administrators may review the hierarchy of their books by clicking on the <?php echo la("collaborative book link", array("mod" => "book")) ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes.
These nodes are now <i>orphans</i>. Administrators should periodically <?php echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
<?php echo la("export their books", array("mod" => "book", "op" => "print")) ?> to a single, flat HTML page which is suitable for printing.</p>
<a name="faq"></a><h3>Maintain a FAQ using a collaborative book</i></h3>
......@@ -782,7 +781,7 @@ function book_help() {
<li>Any comments attached to those relevant posts which you designate as book pages will also be transported into your book. This is a great feature, since much wisdom is shared via comments. And remember that all future comments and edits will automatically be reflected in your book.</li>
<li>You may wish to edit the title and teaser of posts when adding them to your FAQ. This is done on the same page as the <i>Edit book outline</i> button. Clear titles help users navigate quickly to the information that they seek.</li>
<li>Book pages may come from any content type (blog, story, page, etc.). If you are creating a post solely for inclusion in your book, then use the <i>Create book page</i> link.</li>
<li>If you don't see the <i>administer</i> link, then you probably have insufficient <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
<li>If you don't see the <i>administer</i> link, then you probably have insufficient <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
<li>If you want to get really fancy, note that Books are one of the few content types which allow raw PHP in their <i>body</i>. So you've got lots of geeky possibilities there.</li>
</ul>
<?php
......
......@@ -18,12 +18,12 @@ function forum_access($op, $node) {
return $node->status;
}
if ($op == "create") {
return user_access("post content");
return user_access("create forum topics");
}
}
function forum_perm() {
return array("post forum topics without approval");
return array("create forum topics");
}
function forum_conf_options() {
....