2001-12-06 17:33:05 +00:00
<?php
// $Id$
2004-08-21 06:42:38 +00:00
/**
* @file
* Enables users to submit stories, articles or similar content.
*/
2004-03-10 09:32:46 +00:00
/**
2004-05-08 07:17:47 +00:00
* Implementation of hook_help().
2004-03-10 09:32:46 +00:00
*/
2004-05-08 07:17:47 +00:00
function story_help($section) {
2003-08-21 18:21:15 +00:00
switch ($section) {
2004-06-18 15:04:37 +00:00
case 'admin/modules#description':
2004-05-08 07:17:47 +00:00
return t('Enables users to submit stories, articles or similar content.');
2004-01-27 18:47:07 +00:00
case 'node/add#story':
2005-01-15 08:01:09 +00:00
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.');
2003-08-21 18:21:15 +00:00
}
2002-02-25 20:26:38 +00:00
}
2004-03-10 09:32:46 +00:00
/**
2004-05-08 07:17:47 +00:00
* Implementation of hook_node_name().
2004-03-10 09:32:46 +00:00
*/
2004-01-27 18:47:07 +00:00
function story_node_name($node) {
2004-05-08 07:17:47 +00:00
return t('story');
2001-12-06 17:33:05 +00:00
}
2004-03-10 09:32:46 +00:00
/**
2004-05-08 07:17:47 +00:00
* Implementation of hook_perm().
2004-03-10 09:32:46 +00:00
*/
2002-12-10 20:35:20 +00:00
function story_perm() {
2004-07-13 20:40:46 +00:00
return array('create stories', 'edit own stories');
2002-12-10 20:35:20 +00:00
}
2004-03-10 09:32:46 +00:00
/**
2004-05-08 07:17:47 +00:00
* Implementation of hook_access().
2004-03-10 09:32:46 +00:00
*/
2001-12-06 17:33:05 +00:00
function story_access($op, $node) {
2004-03-10 09:32:46 +00:00
global $user;
2004-05-08 07:17:47 +00:00
if ($op == 'create') {
2004-03-10 09:32:46 +00:00
return user_access('create stories');
}
2004-07-31 09:30:09 +00:00
if ($op == 'update' || $op == 'delete') {
if (user_access('edit own stories') && ($user->uid == $node->uid)) {
return TRUE;
}
2001-12-06 17:33:05 +00:00
}
}
2004-06-18 15:04:37 +00:00
/**
* Implementation of hook_menu().
*/
2004-09-16 07:17:56 +00:00
function story_menu($may_cache) {
2004-06-18 15:04:37 +00:00
$items = array();
2004-09-16 07:17:56 +00:00
if ($may_cache) {
$items[] = array('path' => 'node/add/story', 'title' => t('story'),
2004-12-04 10:00:22 +00:00
'access' => user_access('create stories'));
2004-09-16 07:17:56 +00:00
}
2004-06-18 15:04:37 +00:00
return $items;
}
2004-03-10 09:32:46 +00:00
/**
2004-05-08 07:17:47 +00:00
* Implementation of hook_form().
2004-03-10 09:32:46 +00:00
*/
2004-07-04 16:50:02 +00:00
function story_form(&$node) {
2004-05-08 07:17:47 +00:00
$output = '';
2001-12-06 17:33:05 +00:00
2004-05-08 07:17:47 +00:00
if (function_exists('taxonomy_node_form')) {
$output .= implode('', taxonomy_node_form('story', $node));
2002-05-19 23:05:05 +00:00
}
2003-09-20 16:03:05 +00:00
2004-09-27 20:15:54 +00:00
$output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
2004-09-28 19:13:03 +00:00
$output .= filter_form('format', $node->format);
2001-12-06 17:33:05 +00:00
return $output;
}
?>