summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2002-01-31 14:03:17 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2002-01-31 14:03:17 +0000
commit8678951608a1f94f0e18ceb217a8d76aaa5ebba9 (patch)
tree5ad858252543742ac4d47b4cf474b930534aa650
parentd988dae61fdbbcf4802f7de1bbfa8fe4be85827a (diff)
downloadbrdo-8678951608a1f94f0e18ceb217a8d76aaa5ebba9.tar.gz
brdo-8678951608a1f94f0e18ceb217a8d76aaa5ebba9.tar.bz2
- nodes can now be set to static which will pin them to the front page as
long as they are promoted and/or static. - needs an sql update.
-rw-r--r--modules/node.module7
-rw-r--r--modules/node/node.module7
-rw-r--r--update.php7
3 files changed, 14 insertions, 7 deletions
diff --git a/modules/node.module b/modules/node.module
index 17db52dee..57fe3ad8c 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -102,7 +102,7 @@ function node_load($conditions) {
function node_save($node, $filter) {
- $fields = array("nid", "uid", "type", "title", "teaser", "body", "revisions", "score", "status", "comment", "promote", "moderate", "created", "changed", "users", "votes");
+ $fields = array("nid", "uid", "type", "title", "teaser", "body", "revisions", "score", "status", "comment", "promote", "static", "moderate", "created", "changed", "users", "votes");
foreach ($filter as $key => $value) {
/*
@@ -848,6 +848,7 @@ function node_form($edit) {
$output .= form_select(t("Set public/published"), "status", $edit->status, array("Disabled", "Enabled"));
$output .= form_select(t("Queue for moderation"), "moderate", $edit->moderate, array("Disabled", "Enabled"));
$output .= form_select(t("Promote to front page"), "promote", $edit->promote, array("Disabled", "Enabled"));
+ $output .= form_select(t("Static on front page"), "static", $edit->static, array("Disabled", "Enabled"));
$output .= form_select(t("Allow users comments"), "comment", $edit->comment, array("Disabled", "Enabled"));
$output .= form_select(t("Create new revision"), "revision", $edit->revision, array("Disabled", "Enabled"));
}
@@ -997,7 +998,7 @@ function node_submit($node) {
*/
if (user_access("administer nodes")) {
- $fields = array("nid", "uid", "body", "comment", "created", "promote", "moderate", "revisions", "status", "teaser", "title", "type" => $node->type);
+ $fields = array("nid", "uid", "body", "comment", "created", "promote", "static", "moderate", "revisions", "status", "teaser", "title", "type" => $node->type);
}
else {
$fields = array("nid", "uid" => ($user->uid ? $user->uid : 0), "body", "teaser", "title", "type" => $node->type);
@@ -1166,7 +1167,7 @@ function node_page() {
$theme->box($title, node_delete($edit));
break;
default:
- $result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '1' AND created <= '". ($date > 0 ? check_input($date) : time()) ."' ORDER BY created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
+ $result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '1' AND (static = '1' OR created <= '". ($date > 0 ? check_input($date) : time()) ."') ORDER BY static DESC,created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
while ($node = db_fetch_object($result)) {
node_view(node_load(array("nid" => $node->nid, "type" => $node->type)), 1);
}
diff --git a/modules/node/node.module b/modules/node/node.module
index 17db52dee..57fe3ad8c 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -102,7 +102,7 @@ function node_load($conditions) {
function node_save($node, $filter) {
- $fields = array("nid", "uid", "type", "title", "teaser", "body", "revisions", "score", "status", "comment", "promote", "moderate", "created", "changed", "users", "votes");
+ $fields = array("nid", "uid", "type", "title", "teaser", "body", "revisions", "score", "status", "comment", "promote", "static", "moderate", "created", "changed", "users", "votes");
foreach ($filter as $key => $value) {
/*
@@ -848,6 +848,7 @@ function node_form($edit) {
$output .= form_select(t("Set public/published"), "status", $edit->status, array("Disabled", "Enabled"));
$output .= form_select(t("Queue for moderation"), "moderate", $edit->moderate, array("Disabled", "Enabled"));
$output .= form_select(t("Promote to front page"), "promote", $edit->promote, array("Disabled", "Enabled"));
+ $output .= form_select(t("Static on front page"), "static", $edit->static, array("Disabled", "Enabled"));
$output .= form_select(t("Allow users comments"), "comment", $edit->comment, array("Disabled", "Enabled"));
$output .= form_select(t("Create new revision"), "revision", $edit->revision, array("Disabled", "Enabled"));
}
@@ -997,7 +998,7 @@ function node_submit($node) {
*/
if (user_access("administer nodes")) {
- $fields = array("nid", "uid", "body", "comment", "created", "promote", "moderate", "revisions", "status", "teaser", "title", "type" => $node->type);
+ $fields = array("nid", "uid", "body", "comment", "created", "promote", "static", "moderate", "revisions", "status", "teaser", "title", "type" => $node->type);
}
else {
$fields = array("nid", "uid" => ($user->uid ? $user->uid : 0), "body", "teaser", "title", "type" => $node->type);
@@ -1166,7 +1167,7 @@ function node_page() {
$theme->box($title, node_delete($edit));
break;
default:
- $result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '1' AND created <= '". ($date > 0 ? check_input($date) : time()) ."' ORDER BY created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
+ $result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '1' AND (static = '1' OR created <= '". ($date > 0 ? check_input($date) : time()) ."') ORDER BY static DESC,created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
while ($node = db_fetch_object($result)) {
node_view(node_load(array("nid" => $node->nid, "type" => $node->type)), 1);
}
diff --git a/update.php b/update.php
index b053b0578..3c1f0c078 100644
--- a/update.php
+++ b/update.php
@@ -44,7 +44,8 @@ $mysql_updates = array(
"2001-12-31" => "update_17",
"2002-01-05" => "update_18",
"2002-01-17" => "update_19",
- "2002-01-27" => "update_20"
+ "2002-01-27" => "update_20",
+ "2002-01-30" => "update_21"
);
// Update functions
@@ -322,6 +323,10 @@ function update_20() {
update_sql("INSERT INTO blocks SET name='User information', module='user', delta='0', status='2', weight='0', region='1', remove='0', path='';");
}
+function update_21() {
+ update_sql("ALTER TABLE node ADD static int(2) DEFAULT '0' NOT NULL;");
+}
+
/*
** System functions
*/