Commit 86789516 authored by Kjartan's avatar Kjartan

- 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.
parent d988dae6
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -44,7 +44,8 @@
"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
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment