summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-12-07 16:55:38 +0000
committerDries Buytaert <dries@buytaert.net>2004-12-07 16:55:38 +0000
commit60352821bfd61c266c6cda5f797cc7036a9499d2 (patch)
tree9bdf38ec0b9c752caab1397a24a21fff78099151 /modules
parent1365740f6eab386aa16ba39c6f324a3c30adb78d (diff)
downloadbrdo-60352821bfd61c266c6cda5f797cc7036a9499d2.tar.gz
brdo-60352821bfd61c266c6cda5f797cc7036a9499d2.tar.bz2
- Refactored the queue module: removed the queue module's field from the node table. With help from Gerhard.
- Slight addition to INSTALL.txt with regard to PHP versions. - Updated/reworded some node type descriptions as per Boris' suggestions. - Adding missing {} around a table name in update.php.
Diffstat (limited to 'modules')
-rw-r--r--modules/aggregator.module2
-rw-r--r--modules/aggregator/aggregator.module2
-rw-r--r--modules/blog.module2
-rw-r--r--modules/blog/blog.module2
-rw-r--r--modules/comment.module2
-rw-r--r--modules/comment/comment.module2
-rw-r--r--modules/help.module1
-rw-r--r--modules/help/help.module1
-rw-r--r--modules/node.module4
-rw-r--r--modules/node/node.module4
-rw-r--r--modules/page.module2
-rw-r--r--modules/page/page.module2
-rw-r--r--modules/queue.module51
-rw-r--r--modules/story.module2
-rw-r--r--modules/story/story.module2
15 files changed, 39 insertions, 42 deletions
diff --git a/modules/aggregator.module b/modules/aggregator.module
index 6c2a14abd..70eecf130 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -657,7 +657,7 @@ function aggregator_form_feed($edit = array()) {
if ($options) {
$form .= form_checkboxes(t('Categorize news items'), 'category', $values, $options, t('New items in this feed will be automatically filed in the the checked categories as they are received.'));
}
-
+
// Form buttons:
$form .= form_submit(t('Submit'));
if ($edit['fid']) {
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 6c2a14abd..70eecf130 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -657,7 +657,7 @@ function aggregator_form_feed($edit = array()) {
if ($options) {
$form .= form_checkboxes(t('Categorize news items'), 'category', $values, $options, t('New items in this feed will be automatically filed in the the checked categories as they are received.'));
}
-
+
// Form buttons:
$form .= form_submit(t('Submit'));
if ($edit['fid']) {
diff --git a/modules/blog.module b/modules/blog.module
index ca19a446f..fceb01867 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -73,7 +73,7 @@ function blog_help($section) {
case 'node/add/blog':
return variable_get('blog_help', '');
case 'node/add#blog':
- return t("A blog is a regularly updated journal made up of individual entries, often called posts, that are time stamped and typically arranged by the day, with the newest on top (a diary is the reverse). They tend to be quite personal, often containing links to things you've seen, or to editorials that you find interesting. Some blogs also contain original material written solely for the blog. Since a Blog is personal, you and only you have full control over what you publish. The most interesting blog entries or those blog entries that fit the site's topic well might get promoted to the front page by the community or by users with the access do this.");
+ 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.");
}
}
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index ca19a446f..fceb01867 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -73,7 +73,7 @@ function blog_help($section) {
case 'node/add/blog':
return variable_get('blog_help', '');
case 'node/add#blog':
- return t("A blog is a regularly updated journal made up of individual entries, often called posts, that are time stamped and typically arranged by the day, with the newest on top (a diary is the reverse). They tend to be quite personal, often containing links to things you've seen, or to editorials that you find interesting. Some blogs also contain original material written solely for the blog. Since a Blog is personal, you and only you have full control over what you publish. The most interesting blog entries or those blog entries that fit the site's topic well might get promoted to the front page by the community or by users with the access do this.");
+ 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.");
}
}
diff --git a/modules/comment.module b/modules/comment.module
index 5727b728a..b2c523ccd 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -625,7 +625,7 @@ function comment_post($edit) {
// Clear the cache so an anonymous user can see his comment being added.
cache_clear_all();
- // Explain the moderation queue if necessary, and then
+ // Explain the approval queue if necessary, and then
// redirect the user to the node he's commenting on.
if ($status == 1) {
drupal_set_message(t('Your comment has been queued for moderation by site administrators and will be published after approval.'));
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 5727b728a..b2c523ccd 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -625,7 +625,7 @@ function comment_post($edit) {
// Clear the cache so an anonymous user can see his comment being added.
cache_clear_all();
- // Explain the moderation queue if necessary, and then
+ // Explain the approval queue if necessary, and then
// redirect the user to the node he's commenting on.
if ($status == 1) {
drupal_set_message(t('Your comment has been queued for moderation by site administrators and will be published after approval.'));
diff --git a/modules/help.module b/modules/help.module
index cc6722a6e..8852548e5 100644
--- a/modules/help.module
+++ b/modules/help.module
@@ -48,7 +48,6 @@ function help_main() {
<dt>Moderation</dt><dd>The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.<dl>
<dt>Approved</dt><dd>A moderated post which has been accepted by the moderators for publication. (See published).</dd>
<dt>Waiting</dt><dd>A moderated post which is still being voted on to be accepted for publication. (See published.)</dd>
- <dt>Moderators</dt><dd>The group of Drupal users that reviews posts before they are published. These users have the \"access submission queue\" permission. (See Published).</dd></dl></dd>
<dt>Node</dt><dd>The basic data unit in Drupal. Everything is a node or an extension of a node.</dd>
<dt>Public</dt><dd>See published.</dd>
<dt>Published</dt><dd>A node that is viewable by everyone. (See unpublished.)</dd>
diff --git a/modules/help/help.module b/modules/help/help.module
index cc6722a6e..8852548e5 100644
--- a/modules/help/help.module
+++ b/modules/help/help.module
@@ -48,7 +48,6 @@ function help_main() {
<dt>Moderation</dt><dd>The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.<dl>
<dt>Approved</dt><dd>A moderated post which has been accepted by the moderators for publication. (See published).</dd>
<dt>Waiting</dt><dd>A moderated post which is still being voted on to be accepted for publication. (See published.)</dd>
- <dt>Moderators</dt><dd>The group of Drupal users that reviews posts before they are published. These users have the \"access submission queue\" permission. (See Published).</dd></dl></dd>
<dt>Node</dt><dd>The basic data unit in Drupal. Everything is a node or an extension of a node.</dd>
<dt>Public</dt><dd>See published.</dd>
<dt>Published</dt><dd>A node that is viewable by everyone. (See unpublished.)</dd>
diff --git a/modules/node.module b/modules/node.module
index c761615bc..40065bc69 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -29,10 +29,6 @@ function node_help($section) {
<dt>Allow user comments</dt><dd>A node can have comments. These comments can be written by other users (Read-write), or only by admins (Read-only).</dd>
<dt>Revisions</dt><dd>Drupal has a revision system so that you can \"roll back\" to an older version of a post if the new version is not what you want.</dd>
<dt>Promote to front page</dt><dd>To get people to look at the new stuff on your site you can choose to move it to the front page. The front page is configured to show the teasers from only a few of the total nodes you have on your site (To configure how many teasers <a href=\"%teaser\">click here</a>).</dd>
- <dt>In moderation queue</dt><dd>Drupal has a moderation system. If it is active, a node is in one of three states: approved and published, approved and unpublished, and awaiting approval. If you are moderating a node it should be in the moderation queue.</dd>
- <dt>Votes</dt><dd>If you are moderating a node this counts how many votes the node has gotten. Once a node gets a certain number of vote it will either be approved or dropped.
- <dt>Score</dt><dd>The score of the node is gotten by the votes it is given.</dd>
- <dt>Users</dt><dd>The list of users who have voted on a moderated node.</dd>
<dt>Published</dt><dd>When using Drupal's moderation system a node remains unpublished -- unavailable to non-moderators -- until it is marked Published.</dd></dl>
<p>Now that you know what is in a node, here are some of the types of nodes available.</p>", array("%teaser" => url("admin/node/configure/settings")));
diff --git a/modules/node/node.module b/modules/node/node.module
index c761615bc..40065bc69 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -29,10 +29,6 @@ function node_help($section) {
<dt>Allow user comments</dt><dd>A node can have comments. These comments can be written by other users (Read-write), or only by admins (Read-only).</dd>
<dt>Revisions</dt><dd>Drupal has a revision system so that you can \"roll back\" to an older version of a post if the new version is not what you want.</dd>
<dt>Promote to front page</dt><dd>To get people to look at the new stuff on your site you can choose to move it to the front page. The front page is configured to show the teasers from only a few of the total nodes you have on your site (To configure how many teasers <a href=\"%teaser\">click here</a>).</dd>
- <dt>In moderation queue</dt><dd>Drupal has a moderation system. If it is active, a node is in one of three states: approved and published, approved and unpublished, and awaiting approval. If you are moderating a node it should be in the moderation queue.</dd>
- <dt>Votes</dt><dd>If you are moderating a node this counts how many votes the node has gotten. Once a node gets a certain number of vote it will either be approved or dropped.
- <dt>Score</dt><dd>The score of the node is gotten by the votes it is given.</dd>
- <dt>Users</dt><dd>The list of users who have voted on a moderated node.</dd>
<dt>Published</dt><dd>When using Drupal's moderation system a node remains unpublished -- unavailable to non-moderators -- until it is marked Published.</dd></dl>
<p>Now that you know what is in a node, here are some of the types of nodes available.</p>", array("%teaser" => url("admin/node/configure/settings")));
diff --git a/modules/page.module b/modules/page.module
index 96646362f..56a69bf8c 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -21,7 +21,7 @@ function page_help($section) {
case 'admin/modules#description':
return t('Enables the creation of pages that can be added to the navigation system.');
case 'node/add#page':
- return t('If you just want to add a page with a link in the menu to your site, this is the best choice. Unlike a story, a static page bypasses the submission queue.');
+ return t('If you want to add a static page, like an a contact page or an about page, use a page.');
}
}
diff --git a/modules/page/page.module b/modules/page/page.module
index 96646362f..56a69bf8c 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -21,7 +21,7 @@ function page_help($section) {
case 'admin/modules#description':
return t('Enables the creation of pages that can be added to the navigation system.');
case 'node/add#page':
- return t('If you just want to add a page with a link in the menu to your site, this is the best choice. Unlike a story, a static page bypasses the submission queue.');
+ return t('If you want to add a static page, like an a contact page or an about page, use a page.');
}
}
diff --git a/modules/queue.module b/modules/queue.module
index 30c4612b2..fc83af62e 100644
--- a/modules/queue.module
+++ b/modules/queue.module
@@ -58,20 +58,16 @@ function queue_count() {
return ($result) ? db_result($result, 0) : 0;
}
-function queue_score($id) {
- $result = db_query('SELECT score FROM {node} WHERE nid = %d', $id);
+function queue_score($nid) {
+ $result = db_query('SELECT SUM(vote) FROM {queue} WHERE nid = %d', $nid);
return ($result) ? db_result($result, 0) : 0;
}
function queue_vote($node, $vote) {
global $user;
- if (!field_get($node->users, $user->uid)) {
- // Update submission's score- and votes-field:
- db_query("UPDATE {node} SET score = score $vote, votes = votes + 1, users = '". field_set($node->users, $user->uid, $vote) ."' WHERE nid = %d", $node->nid);
-
- // Reload the updated node from the database:
- $node = node_load(array('nid' => $node->nid));
+ if (!isset($node->voters[$user->uid])) {
+ db_query("INSERT INTO {queue} (nid, uid, vote) VALUES (%d, %d, %d)", $node->nid, $user->uid, $vote);
$terms = module_invoke('taxonomy', 'node_get_terms', $node->nid, 'tid');
foreach ($terms as $term) {
@@ -113,6 +109,9 @@ function queue_vote($node, $vote) {
drupal_set_message(t('The post has expired.'));
}
}
+
+ // Reload the updated node from the database:
+ $node = node_load(array('nid' => $node->nid), NULL, TRUE);
}
}
@@ -124,11 +123,12 @@ function queue_overview() {
$header = array(array('data' => t('Subject')), array('data' => t('Author')), array('data' => t('Type')), array('data' => t('Score')));
- $sresult = pager_query('SELECT n.*, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.moderate = 1', 10, 0);
+ $sresult = pager_query('SELECT DISTINCT(n.nid), n.title, n.type, u.name, u.uid, SUM(IF(q.uid=%d,1,0)) AS voted, SUM(q.vote) AS score FROM {node} n '. node_access_join_sql() .' INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {queue} q ON n.nid = q.nid WHERE n.moderate = 1 AND '. node_access_where_sql(), 10, 0,
+ 'SELECT DISTINCT(n.nid) FROM {node} n '. node_access_join_sql() .' WHERE n.moderate = 1 AND '. node_access_where_sql(), $user->uid);
while ($node = db_fetch_object($sresult)) {
- if ($user->uid == $node->uid || field_get($node->users, $user->uid)) {
- $rows[] = array(array('data' => l($node->title, 'queue/'. $node->nid), 'class' => 'title'), array('data' => format_name($node), 'class' => 'name'), array('data' => module_invoke($node->type, 'node_name', $node), 'class' => 'type'), array('data' => queue_score($node->nid), 'class' => 'score'));
+ if ($user->uid == $node->uid || $node->voted) {
+ $rows[] = array(array('data' => l($node->title, 'queue/'. $node->nid), 'class' => 'title'), array('data' => format_name($node), 'class' => 'name'), array('data' => module_invoke($node->type, 'node_name', $node), 'class' => 'type'), array('data' => $node->score, 'class' => 'score'));
}
else {
$rows[] = array(array('data' => l($node->title, 'queue/'. $node->nid), 'class' => 'title'), array('data' => format_name($node), 'class' => 'name'), array('data' => module_invoke($node->type, 'node_name', $node), 'class' => 'type'), array('data' => l(t('vote'), 'queue/'. $node->nid), 'class' => 'score'));
@@ -168,7 +168,7 @@ function queue_view($nid) {
$node = node_load(array('nid' => $nid, 'moderate' => 1));
if ($node) {
- if ($user->uid != $node->uid && !field_get($node->users, $user->uid)) {
+ if ($user->uid != $node->uid && !isset($node->voters[$user->uid])) {
if ($op == t('Vote') && $votes[$edit['vote']]) {
// If it is a valid vote, record it.
@@ -234,13 +234,10 @@ function queue_block($op = 'list', $delta = 0) {
$id = arg(2);
}
$node = node_load(array('nid' => $id));
- if (($user->uid == $node->uid || field_get($node->users, $user->uid)) && $node->moderate == 1) {
- foreach (explode(',', $node->users) as $vote) {
- if ($vote) {
- $data = explode('=', $vote);
- $account = user_load(array('uid' => $data[0]));
- $output .= format_name($account) ." voted \"$data[1]\".<br />";
- }
+ if (($user->uid == $node->uid || isset($node->voters[$user->uid])) && $node->moderate == 1) {
+ foreach ($node->voters as $uid => $vote) {
+ $account = user_load(array('uid' => $uid));
+ $output .= t('%user voted %vote', array('%user' => format_name($account), '%vote' => $vote)) .'<br />';
}
$block['subject'] = t('Moderation results');
@@ -258,17 +255,27 @@ function queue_block($op = 'list', $delta = 0) {
*/
function queue_nodeapi(&$node, $op) {
switch ($op) {
- case 'fields':
- return array('score', 'users', 'votes');
+ case 'load':
+ $result = db_query("SELECT uid, vote FROM {queue} WHERE nid = %d", $node->nid);
+ $node->voters = array();
+ $node->score = 0;
+ while ($voter = db_fetch_object($result)) {
+ $node->voters[$voter->uid] = $voter->vote;
+ $node->score += $voter->vote;
+ }
+ break;
case 'validate':
if ($node->nid && $node->moderate) {
// Reset votes when node is updated:
$node->score = 0;
- $node->users = '';
+ $node->voters = array();
$node->votes = 0;
}
break;
case 'insert':
+ if ($node->moderate) {
+ db_query("INSERT INTO {queue} (nid, uid) VALUES (%d, %d)", $node->nid, $node->uid);
+ }
case 'update':
if ($node->moderate && user_access('access submission queue')) {
drupal_set_message(t('The post is queued for approval. You can check the votes in the <a href="%queue">submission queue</a>.', array('%queue' => url('queue'))));
diff --git a/modules/story.module b/modules/story.module
index 44624f88d..f9fb59180 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -26,7 +26,7 @@ function story_help($section) {
case 'node/add/story':
return variable_get('story_help', '');
case 'node/add#story':
- return t('A story is similar to an article and usually gets promoted to the front page after approval or moderation.');
+ return t('A story is similar to an article and usually gets promoted to the front page. If you want to post news items, articles or maintain a group blog, use stories.');
}
}
diff --git a/modules/story/story.module b/modules/story/story.module
index 44624f88d..f9fb59180 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -26,7 +26,7 @@ function story_help($section) {
case 'node/add/story':
return variable_get('story_help', '');
case 'node/add#story':
- return t('A story is similar to an article and usually gets promoted to the front page after approval or moderation.');
+ return t('A story is similar to an article and usually gets promoted to the front page. If you want to post news items, articles or maintain a group blog, use stories.');
}
}