drupal/modules/story/story.module

86 lines
3.6 KiB
Plaintext
Raw Normal View History

<?php
// $Id$
function story_help() {
$output .= "<p>The story module lets your users submit articles for consideration by the rest of the community, who can vote on them if moderation is enabled. Stories usually follow a publishing flow of <b>submit -&gt; moderate -&gt; post to the main page -&gt; comments</b>. Administrators are able to shortcut this flow as desired.</p>";
$output .= "In ". l("site configuration &gt;&gt; modules &gt;&gt; story", "admin/system/modules/story") ." you can set up an introductory text for story authors, and a floor on the number of words which may be included in a story. This is designed to help discourage the submission of trivially short stories.";
return $output;
}
function story_system($field){
$system["description"] = t("Enables users to submit stories, articles or similar content.");
$system["admin_help"] = t("Stories are like newspaper articles. They tend to follow a publishing flow of <b>submit -&gt; moderate -&gt; post to the main page -&gt; comments</b>. Below you may fix a minimum word count for stories and also write some submission or content guidelines for users wanting to post a story.");
return $system[$field];
}
function story_settings() {
$output .= form_textarea("Explanation or submission guidelines", "story_help", variable_get("story_help", ""), 70, 5, "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), array(0 => "0 words", 10 => "10 words", 25 => "25 words", 50 => "50 words", 75 => "75 words", 100 => "100 words", 125 => "125 words", 150 => "150 words", 175 => "175 words", 200 => "200 words"), 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;
}
function story_node($field) {
$info["name"] = t("story");
$info["description"] = t("A story is a post that is submitted to the attention of other users and is queued in the submission queue. Users and moderators vote on the posts they like or dislike, promoting or demoting them. When a post gets above a certain threshold it automatically gets promoted to the front page.");
return $info[$field];
}
function story_perm() {
return array("create stories");
}
function story_access($op, $node) {
if ($op == "view") {
return $node->status;
}
if ($op == "create") {
return user_access("create stories");
}
}
function story_link($type) {
2003-04-21 14:55:03 +00:00
$links = array();
if ($type == "menu.create" && user_access("create stories")) {
2003-01-06 19:51:01 +00:00
$links[] = l(t("create story"), "node/add/story", array("title" => t("Add a new story.")));
}
2003-04-21 14:55:03 +00:00
return $links;
}
function story_form(&$node, &$help, &$error) {
if (isset($node->body)) {
/*
** Validate the size of the story:
*/
if (count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) {
- Bugfix: renamed the SQL field 'types' to 'nodes' because 'types' is a reserved keyword in MySQL 4. This fixes critical bug #1618. Patch by Marco. ==> This fix requires to run update.php! - Bugfix: made sessions work without warnings when register_globals is turned off. The solution is to use $_SESSION instead of session_register(). This fixes critical bug #1797. Patch by Marco. - Bugfix: sometimes error messages where being discarded when previewing a node. Patch by Craig Courtney. - Bugfix: fixed charset problems. This fixes critical bug #1549. Patch '0023.charset.patch' by Al. - Code improvements: removed some dead code from the comment module. Patch by Marco. - Documentation improvements: polished the node module help texts and form descriptions. Patch '0019.node.module.help.patch' by Al. - CSS improvements all over the map! Patch '0021.more.css.patch' by Al. - GUI improvements: improved the position of Druplicon in the admin menu. Patch '0020.admin.logo.patch' by Al. - GUI improvements: new logos for theme Marvin and theme UnConeD. Logos by Kristjan Jansen. - GUI improvements: small changes to the output emitted by the profile module. Suggestions by Steven Wittens. - GUI improvements: small fixes to Xtemplate. Patch '0022.xtemplate.css.patch' by Al. TODO: - Some modules such as the buddy list module and the annotation module in the contributions repository are also using session_register(). They should be updated. We should setup a task on Drupal. - There is code emitting '<div align="right">' which doesn't validate. - Does our XML feeds validate with the charset changes? - The forum module's SQL doesn't work properly on PostgreSQL.
2003-06-04 18:24:39 +00:00
$error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>";
}
}
else {
/*
** Carry out some explanation or submission guidelines:
*/
$help = variable_get("story_help", "");
}
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("story", $node));
}
2001-12-08 13:29:43 +00:00
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
return $output;
}
?>