story.module 1.23 KB
Newer Older
Dries's avatar
   
Dries committed
1
<?php
2
// $Id$
Dries's avatar
 
Dries committed
3

Dries's avatar
   
Dries committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function story_node($field) {
  $info = array("name" => "story");

  return $info[$field];
}

function story_access($op, $node) {

  if ($op == "view") {
    return $node->nid && $node->status && !$node->moderate;
  }

  if ($op == "create") {
    return 1;
  }

  if ($op == "update") {
    return user_access("administer nodes");
  }

  if ($op == "delete") {
    return user_access("adminster nodes");
  }

}

Dries's avatar
   
Dries committed
30
31
function story_help() {
 ?>
Dries's avatar
   
Dries committed
32
33
34
35
36
37
38
/*
  // TODO: update documentation, outdated

  <p>Queued stories: user-contributed stories are automatically whisked away to a submission queue for moderators (i.e. registered user) to frown at.  Moderators vote whether or not a story should be posted to the front page for discussion.</p>
  <p>Posted stories: published stories accessible to all visitors.</p>
  <p>Dumped stories: rejected stories that are no longer available to visitors.</p>
*/
Dries's avatar
   
Dries committed
39
 <?php
Dries's avatar
   
Dries committed
40
41
}

Dries's avatar
   
Dries committed
42
function story_form($node) {
Dries's avatar
   
Dries committed
43

Dries's avatar
   
Dries committed
44
  $output = form_textarea(t("Body"), "body", $node->body, 60, 15, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
Dries's avatar
   
Dries committed
45

Dries's avatar
   
Dries committed
46
  return $output;
Dries's avatar
   
Dries committed
47
48
}

Dries's avatar
   
Dries committed
49
function story_save($node) {
Dries's avatar
   
Dries committed
50

Dries's avatar
   
Dries committed
51
  if ($node->nid) {
Dries's avatar
   
Dries committed
52
    return array();
Dries's avatar
   
Dries committed
53
  }
Dries's avatar
   
Dries committed
54
55
  else {
    return array("promote" => 1, "moderate" => 1);
Dries's avatar
   
Dries committed
56
  }
Dries's avatar
   
Dries committed
57

Dries's avatar
   
Dries committed
58
59
}

Dries's avatar
   
Dries committed
60
?>