summaryrefslogtreecommitdiff
path: root/modules/node.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-11-09 13:59:36 +0000
committerDries Buytaert <dries@buytaert.net>2002-11-09 13:59:36 +0000
commit562df8fe43f8794317c974dae463f5470cfdc497 (patch)
tree73d897d51f8b1873eff41193733d309495d01aea /modules/node.module
parent29adfb4086c8ef6102d9f22f5351382485444be5 (diff)
downloadbrdo-562df8fe43f8794317c974dae463f5470cfdc497.tar.gz
brdo-562df8fe43f8794317c974dae463f5470cfdc497.tar.bz2
* Added Jeremy's pager:
"This is a simple, generic pager for Drupal-CVS. It is designed to be easily themeable and expandable. The code is highly-commented to enhance readability." "Pagers are constructed by combining the provided pieces (all of which can be easily modified to display the text or image you prefer) into your custom pager." * Statistics module fixes by Jeremy: - removed superfluous check for existence of watchdog() - saving changes in admin page displays status and returns same page - no longer return 1971/01/01 in "view statistics" table - switched from "!=" to "<>" in SQL queries for ANSI-SQL compliance - switched from "MAX(timestamp) as timestamp" to "MAX(timestamp) as max_timestamp" moving towards ANSI-SQL compliance. * Added a "theme_item_list" function to format itemized lists. Also changed a couple of modules to take advantage of it. Makes for a more consistent UI.
Diffstat (limited to 'modules/node.module')
-rw-r--r--modules/node.module15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/node.module b/modules/node.module
index a9c4863f9..38718cb52 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -491,7 +491,7 @@ function node_admin_nodes() {
$queries = array(array("ORDER BY n.created DESC", "new nodes"), array("ORDER BY n.changed DESC", "updated nodes"), array("WHERE n.status = 1 AND n.moderate = 0 ORDER BY n.nid DESC", "published nodes"), array("WHERE n.status = 0 AND n.moderate = 0 ORDER BY n.nid DESC", "non-published nodes"), array("WHERE n.status = 1 AND n.moderate = 1 ORDER BY n.nid DESC", "pending nodes"), array("WHERE n.status = 1 AND n.promote = 1 ORDER BY n.nid DESC", "promoted nodes"));
- $result = db_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 1][0] ." LIMIT 50");
+ $result = db_query_pager("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 1][0], 50);
foreach ($queries as $key => $value) {
$links[] = la($value[1], array("mod" => "node", "op" => "nodes", "query" => $key));
@@ -504,7 +504,8 @@ function node_admin_nodes() {
while ($node = db_fetch_object($result)) {
$output .= "<tr><td>". l(check_output($node->title), array("id" => $node->nid)) ."</td><td>". module_invoke($node->type, "node", "name") ."</td><td nowrap=\"nowrap\">". format_name($node) ."</td><td>". ($node->status ? t("published") : t("not published")) ."</td><td nowrap=\"nowrap\">". la(t("edit node"), array("mod" => "node", "op" => "edit", "id" => $node->nid)) ."</td><td nowrap=\"nowrap\">". la(t("delete node"), array("mod" => "node", "op" => "delete", "id" => $node->nid)) ."</td></tr>";
}
- $output .= "</table>";
+ $output .= "<tr><td colspan=\"6\">". pager_display(NULL, 50, 0, "admin") ."</td></tr></table>";
+
return $output;
}
@@ -1296,19 +1297,21 @@ function node_page() {
if ($or) {
// this is an OR of terms
- $result = db_query("SELECT DISTINCT(n.nid), type FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND ". ($id ? "nid = '$id' AND " : "") ."status = '1' ORDER BY static DESC, created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
+ $result = db_query_pager("SELECT DISTINCT(n.nid), type FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND ". ($id ? "nid = '$id' AND " : "") ."status = '1' ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
}
else if ($and) {
// this is an AND
- $result = db_query("SELECT n.nid, type, count(*) AS c FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND ". ($id ? "nid = '$id' AND " : "") ."status = '1' GROUP BY n.nid HAVING c = ".count($terms)." ORDER BY static DESC, created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
+ $result = db_query_pager("SELECT n.nid, type, count(*) AS c FROM node n LEFT JOIN term_node r ON n.nid = r.nid WHERE tid IN (".implode(",", $terms).") AND ". ($id ? "nid = '$id' AND " : "") ."status = '1' GROUP BY n.nid HAVING c = ".count($terms)." ORDER BY static DESC, created DESC", ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
}
else {
- $result = db_query("SELECT nid, type FROM node WHERE ". ($id ? "nid = '$id'" : "promote = '1'") ." AND status = '1' ORDER BY static DESC, created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
+ $result = db_query_pager("SELECT nid, type FROM node WHERE ". ($id ? "nid = '$id'" : "promote = '1'") ." AND status = '1' ORDER BY static DESC, created DESC", ($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);
}
+ print pager_display(NULL, ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10)));
}
}
@@ -1334,4 +1337,4 @@ function node_update_index() {
"select" => "SELECT n.nid as lno, n.title as text1, n.body as text2 FROM node n WHERE n.status = 1 AND moderate = 0 and (created > " . variable_get("node_cron_last", 1) . " or changed > " . variable_get("node_cron_last", 1) . ")");
}
-?> \ No newline at end of file
+?>