Commit 7415e0b1 authored by Dries's avatar Dries

- Patch #16192 by Neil: moved the submission guidelines found in forum, story,...

- 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.
parent e3268ba7
......@@ -6,15 +6,6 @@
* Enables keeping an easily and regularly updated web page or a blog.
*/
/**
* 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().
*/
......@@ -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.");
}
......@@ -192,17 +179,6 @@ function blog_page_last() {
print theme('page', $output);
}
/**
* 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().
*/
......
......@@ -6,15 +6,6 @@
* Enables keeping an easily and regularly updated web page or a blog.
*/
/**
* 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().
*/
......@@ -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.");
}
......@@ -192,17 +179,6 @@ function blog_page_last() {
print theme('page', $output);
}
/**
* 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().
*/
......
......@@ -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.'));
......
......@@ -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.'));
......
......@@ -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)) {
......
......@@ -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)) {
......
......@@ -13,27 +13,13 @@ 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().
*/
......@@ -79,17 +65,6 @@ function story_menu($may_cache) {
return $items;
}
/**
* 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().
*/
......
......@@ -13,27 +13,13 @@ 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().
*/
......@@ -79,17 +65,6 @@ function story_menu($may_cache) {
return $items;
}
/**
* 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().
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment