summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-01-26 22:59:41 +0000
committerDries Buytaert <dries@buytaert.net>2005-01-26 22:59:41 +0000
commit7415e0b1c8330741cac39f3b10b2b728d8755e72 (patch)
tree102a6e7c00250a885506b587b1c1ef4421d56b50
parente3268ba79b17ca92ba688b8f57bedee0ef164204 (diff)
downloadbrdo-7415e0b1c8330741cac39f3b10b2b728d8755e72.tar.gz
brdo-7415e0b1c8330741cac39f3b10b2b728d8755e72.tar.bz2
- Patch #16192 by Neil: moved the submission guidelines found in forum, story, and blog and the minimum number of words found in story and blog (blog had a slight bug) into the node module.
-rw-r--r--modules/blog.module24
-rw-r--r--modules/blog/blog.module24
-rw-r--r--modules/forum.module6
-rw-r--r--modules/forum/forum.module6
-rw-r--r--modules/node.module19
-rw-r--r--modules/node/node.module19
-rw-r--r--modules/story.module25
-rw-r--r--modules/story/story.module25
8 files changed, 34 insertions, 114 deletions
diff --git a/modules/blog.module b/modules/blog.module
index dc40360c5..304852177 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -7,15 +7,6 @@
*/
/**
- * Implementation of hook_settings().
- */
-function blog_settings() {
- $output = form_textarea(t('Explanation or submission guidelines'), 'blog_help', variable_get('blog_help', ''), 70, 5, t('This text will be displayed at the top of the blog submission form. It is useful for helping or instructing your users.'));
- $output .= form_select(t('Minimum number of words in a blog entry'), 'minimum_blog_size', variable_get('minimum_blog_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t("The minimum number of words a personal blog entry should contain. This is useful to rule out submissions that do not meet the site's standards, such as short test posts."));
- return $output;
-}
-
-/**
* Implementation of hook_node_name().
*/
function blog_node_name($node) {
@@ -68,10 +59,6 @@ function blog_help($section) {
<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/modules#description':
return t('Enables keeping an easily and regularly updated web page or a blog.');
- case 'admin/settings/blog':
- return t("<p>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.</p>");
- case 'node/add/blog':
- return variable_get('blog_help', '');
case 'node/add#blog':
return t("A blog is a regularly updated journal or diary made up of individual posts shown in reversed chronological order. A blog is tightly coupled to the author so each user will have his 'own' blog.");
}
@@ -193,17 +180,6 @@ function blog_page_last() {
}
/**
- * Implementation of hook_validate().
- *
- * Ensures the blog entry is of adequate length.
- */
-function blog_validate(&$node) {
- if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_blog_size', 0)) {
- form_set_error('body', t('The body of your blog is too short. You need at least %words words to submit your blog.', array('%words' => variable_get('minimum_story_size', 0))));
- }
-}
-
-/**
* Implementation of hook_form().
*/
function blog_form(&$node) {
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index dc40360c5..304852177 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -7,15 +7,6 @@
*/
/**
- * Implementation of hook_settings().
- */
-function blog_settings() {
- $output = form_textarea(t('Explanation or submission guidelines'), 'blog_help', variable_get('blog_help', ''), 70, 5, t('This text will be displayed at the top of the blog submission form. It is useful for helping or instructing your users.'));
- $output .= form_select(t('Minimum number of words in a blog entry'), 'minimum_blog_size', variable_get('minimum_blog_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t("The minimum number of words a personal blog entry should contain. This is useful to rule out submissions that do not meet the site's standards, such as short test posts."));
- return $output;
-}
-
-/**
* Implementation of hook_node_name().
*/
function blog_node_name($node) {
@@ -68,10 +59,6 @@ function blog_help($section) {
<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/modules#description':
return t('Enables keeping an easily and regularly updated web page or a blog.');
- case 'admin/settings/blog':
- return t("<p>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.</p>");
- case 'node/add/blog':
- return variable_get('blog_help', '');
case 'node/add#blog':
return t("A blog is a regularly updated journal or diary made up of individual posts shown in reversed chronological order. A blog is tightly coupled to the author so each user will have his 'own' blog.");
}
@@ -193,17 +180,6 @@ function blog_page_last() {
}
/**
- * Implementation of hook_validate().
- *
- * Ensures the blog entry is of adequate length.
- */
-function blog_validate(&$node) {
- if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_blog_size', 0)) {
- form_set_error('body', t('The body of your blog is too short. You need at least %words words to submit your blog.', array('%words' => variable_get('minimum_story_size', 0))));
- }
-}
-
-/**
* Implementation of hook_form().
*/
function blog_form(&$node) {
diff --git a/modules/forum.module b/modules/forum.module
index ab19b4f3b..3ebb8f34b 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -26,11 +26,6 @@ function forum_help($section) {
case 'node/add#forum':
return t('A forum is a threaded discussion, enabling users to communicate about a particular topic.');
}
-
- // The 'add forum topic' form takes a variable argument:
- if (substr($section, 0, 14) == 'node/add/forum'){
- return variable_get('forum_help', '');
- }
}
/**
@@ -80,7 +75,6 @@ function forum_settings() {
$group .= _taxonomy_term_select(t('Containers'), 'forum_containers', variable_get('forum_containers', array()), variable_get('forum_nav_vocabulary', ''), t('You can choose forums which will not have topics, but will be just containers for other forums. This lets you both group and nest forums.'), 1, '<'. t('none') .'>');
$output = form_group(t('Forum structure settings'), $group);
- $group = form_textarea(t('Explanation or submission guidelines'), 'forum_help', variable_get('forum_help', ''), 70, 5, t('This text will be displayed at the top of the forum submission form. It is useful for helping or instructing your users.'));
$group .= form_textfield(t('Forum icon path'), 'forum_icon_path', variable_get('forum_icon_path', ''), 30, 255, t('The path to the forum icons. Leave blank to disable icons. Don\'t add a trailing slash. Default icons are available in the "misc" directory.'));
$group .= form_select(t('Hot topic threshold'), 'forum_hot_topic', variable_get('forum_hot_topic', 15), drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 10000)), t('The number of posts a topic must have to be considered <strong>hot</strong>.'));
$group .= form_select(t('Topics per page'), 'forum_per_page', variable_get('forum_per_page', 25), drupal_map_assoc(array(10, 25, 50, 75, 100)), t('The default number of topics displayed per page; links to browse older messages are automatically being displayed.'));
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index ab19b4f3b..3ebb8f34b 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -26,11 +26,6 @@ function forum_help($section) {
case 'node/add#forum':
return t('A forum is a threaded discussion, enabling users to communicate about a particular topic.');
}
-
- // The 'add forum topic' form takes a variable argument:
- if (substr($section, 0, 14) == 'node/add/forum'){
- return variable_get('forum_help', '');
- }
}
/**
@@ -80,7 +75,6 @@ function forum_settings() {
$group .= _taxonomy_term_select(t('Containers'), 'forum_containers', variable_get('forum_containers', array()), variable_get('forum_nav_vocabulary', ''), t('You can choose forums which will not have topics, but will be just containers for other forums. This lets you both group and nest forums.'), 1, '<'. t('none') .'>');
$output = form_group(t('Forum structure settings'), $group);
- $group = form_textarea(t('Explanation or submission guidelines'), 'forum_help', variable_get('forum_help', ''), 70, 5, t('This text will be displayed at the top of the forum submission form. It is useful for helping or instructing your users.'));
$group .= form_textfield(t('Forum icon path'), 'forum_icon_path', variable_get('forum_icon_path', ''), 30, 255, t('The path to the forum icons. Leave blank to disable icons. Don\'t add a trailing slash. Default icons are available in the "misc" directory.'));
$group .= form_select(t('Hot topic threshold'), 'forum_hot_topic', variable_get('forum_hot_topic', 15), drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 10000)), t('The number of posts a topic must have to be considered <strong>hot</strong>.'));
$group .= form_select(t('Topics per page'), 'forum_per_page', variable_get('forum_per_page', 25), drupal_map_assoc(array(10, 25, 50, 75, 100)), t('The default number of topics displayed per page; links to browse older messages are automatically being displayed.'));
diff --git a/modules/node.module b/modules/node.module
index b1c903aff..836cb2a35 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -53,6 +53,10 @@ function node_help($section) {
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions') {
return t('The revisions let you track differences between multiple versions of a post.');
}
+
+ if (arg(0) == 'node' && arg(1) == 'add' && $type = arg(2)) {
+ return variable_get($type .'_help', '');
+ }
}
/**
@@ -825,14 +829,19 @@ function node_types() {
print theme('page', theme('table', $header, $rows));
}
-function node_types_configure($type = NULL) {
+function node_types_configure() {
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
if ($_POST['op']) {
$_GET['q'] = 'admin/node/configure/types';
}
system_settings_save();
- $output .= implode('', node_invoke_nodeapi($type, 'settings'));
+ $type = arg(4);
+
+ $group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name'))));
+ $group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name'))));
+ $output = form_group(t('Submission form'), $group);
+ $output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings')));
print theme('page', system_settings_form($output));
}
@@ -1062,6 +1071,12 @@ function node_validate($node) {
}
}
+ // Make sure the body has the minimim number of words.
+ // todo use a better word counting algorithm that will work in other languages
+ if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_'. $node->type .'_size', 0)) {
+ form_set_error('body', t('The body of your %type is too short. You need at least %words words.', array('%words' => variable_get('minimum_'. $node->type .'_size', 0), '%type' => node_invoke($node->type, 'node_name'))));
+ }
+
// Auto-generate the teaser, but only if it hasn't been set (e.g. by a
// module-provided 'teaser' form item).
if (!isset($node->teaser)) {
diff --git a/modules/node/node.module b/modules/node/node.module
index b1c903aff..836cb2a35 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -53,6 +53,10 @@ function node_help($section) {
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions') {
return t('The revisions let you track differences between multiple versions of a post.');
}
+
+ if (arg(0) == 'node' && arg(1) == 'add' && $type = arg(2)) {
+ return variable_get($type .'_help', '');
+ }
}
/**
@@ -825,14 +829,19 @@ function node_types() {
print theme('page', theme('table', $header, $rows));
}
-function node_types_configure($type = NULL) {
+function node_types_configure() {
// Go to the listing page when we submit this form, system_settings_save() calls drupal_goto().
if ($_POST['op']) {
$_GET['q'] = 'admin/node/configure/types';
}
system_settings_save();
- $output .= implode('', node_invoke_nodeapi($type, 'settings'));
+ $type = arg(4);
+
+ $group = form_textarea(t('Explanation or submission guidelines'), $type .'_help', variable_get($type .'_help', ''), 70, 5, t('This text will be displayed at the top of the %type submission form. It is useful for helping or instructing your users.', array('%type' => node_invoke($type, 'node_name'))));
+ $group .= form_select(t('Minimum number of words'), 'minimum_'. $type .'_size', variable_get('minimum_'. $type .'_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a %type must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.', array('%type' => node_invoke($type, 'node_name'))));
+ $output = form_group(t('Submission form'), $group);
+ $output .= form_group(t('Workflow'), implode('', node_invoke_nodeapi($type, 'settings')));
print theme('page', system_settings_form($output));
}
@@ -1062,6 +1071,12 @@ function node_validate($node) {
}
}
+ // Make sure the body has the minimim number of words.
+ // todo use a better word counting algorithm that will work in other languages
+ if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_'. $node->type .'_size', 0)) {
+ form_set_error('body', t('The body of your %type is too short. You need at least %words words.', array('%words' => variable_get('minimum_'. $node->type .'_size', 0), '%type' => node_invoke($node->type, 'node_name'))));
+ }
+
// Auto-generate the teaser, but only if it hasn't been set (e.g. by a
// module-provided 'teaser' form item).
if (!isset($node->teaser)) {
diff --git a/modules/story.module b/modules/story.module
index 0a6dedf2b..4394f5f44 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -13,28 +13,14 @@ function story_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Enables users to submit stories, articles or similar content.');
- case 'admin/settings/story':
- return t("Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.");
case 'admin/help#story':
return t("Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles. By default, no menu item, or navigation element is created for a story. An extra feature of a story is, that an administrator can specify a submission guideline and enforce a minimum word count for user submitted stories");
- case 'node/add/story':
- return variable_get('story_help', '');
case 'node/add#story':
return t('Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.');
}
}
/**
- * Implementation of hook_settings().
- */
-function story_settings() {
- $output .= form_textarea(t('Explanation or submission guidelines'), 'story_help', variable_get('story_help', ''), 70, 5, t('This text will be displayed at the top of the story submission form. It is useful for helping or instructing your users.'));
- $output .= form_select(t('Minimum number of words'), 'minimum_story_size', variable_get('minimum_story_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a story must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.'));
-
- return $output;
-}
-
-/**
* Implementation of hook_node_name().
*/
function story_node_name($node) {
@@ -80,17 +66,6 @@ function story_menu($may_cache) {
}
/**
- * Implementation of hook_validate().
- *
- * Ensures the story is of adequate length.
- */
-function story_validate(&$node) {
- if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_story_size', 0)) {
- form_set_error('body', t('The body of your story is too short. You need at least %words words to submit your story.', array('%words' => variable_get('minimum_story_size', 0))));
- }
-}
-
-/**
* Implementation of hook_form().
*/
function story_form(&$node) {
diff --git a/modules/story/story.module b/modules/story/story.module
index 0a6dedf2b..4394f5f44 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -13,28 +13,14 @@ function story_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Enables users to submit stories, articles or similar content.');
- case 'admin/settings/story':
- return t("Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.");
case 'admin/help#story':
return t("Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles. By default, no menu item, or navigation element is created for a story. An extra feature of a story is, that an administrator can specify a submission guideline and enforce a minimum word count for user submitted stories");
- case 'node/add/story':
- return variable_get('story_help', '');
case 'node/add#story':
return t('Stories are articles in their simplest form: they have a title, a teaser and a body, but can be extended by other modules. The teaser is part of the body too. Stories may be used as a personal blog or for news articles.');
}
}
/**
- * Implementation of hook_settings().
- */
-function story_settings() {
- $output .= form_textarea(t('Explanation or submission guidelines'), 'story_help', variable_get('story_help', ''), 70, 5, t('This text will be displayed at the top of the story submission form. It is useful for helping or instructing your users.'));
- $output .= form_select(t('Minimum number of words'), 'minimum_story_size', variable_get('minimum_story_size', 0), drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200)), t('The minimum number of words a story must be to be considered valid. This can be useful to rule out submissions that do not meet the site\'s standards, such as short test posts.'));
-
- return $output;
-}
-
-/**
* Implementation of hook_node_name().
*/
function story_node_name($node) {
@@ -80,17 +66,6 @@ function story_menu($may_cache) {
}
/**
- * Implementation of hook_validate().
- *
- * Ensures the story is of adequate length.
- */
-function story_validate(&$node) {
- if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_story_size', 0)) {
- form_set_error('body', t('The body of your story is too short. You need at least %words words to submit your story.', array('%words' => variable_get('minimum_story_size', 0))));
- }
-}
-
-/**
* Implementation of hook_form().
*/
function story_form(&$node) {