summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/tablesort.inc68
-rw-r--r--includes/theme.inc13
-rw-r--r--misc/drupal.css13
-rw-r--r--modules/comment.module9
-rw-r--r--modules/comment/comment.module9
-rw-r--r--themes/xtemplate/default/xtemplate.css6
-rw-r--r--themes/xtemplate/pushbutton/xtemplate.css6
7 files changed, 64 insertions, 60 deletions
diff --git a/includes/tablesort.inc b/includes/tablesort.inc
index ce30a409a..51943e403 100644
--- a/includes/tablesort.inc
+++ b/includes/tablesort.inc
@@ -2,48 +2,57 @@
// $Id$
function tablesort_init($header) {
- static $ts;
-
- if (empty($ts)) {
- $ts = tablesort_get_order($header);
- $ts['sort'] = tablesort_get_sort($header);
- $ts['query_string'] = tablesort_get_querystring();
- }
+ $ts = tablesort_get_order($header);
+ $ts['sort'] = tablesort_get_sort($header);
+ $ts['query_string'] = tablesort_get_querystring();
return $ts;
}
function tablesort_pager() {
$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
- unset($cgi['q'], $cgi["from"]);
+ unset($cgi['q'], $cgi['from']);
return $cgi;
}
function tablesort_sql($header) {
$ts = tablesort_init($header);
- $sql = check_query($ts['sql']);
- $sort = strtoupper(check_query($ts['sort']));
- return " ORDER BY $sql $sort";
+ if ($ts['field']) {
+ $sql = check_query($ts['sql']);
+ $sort = strtoupper(check_query($ts['sort']));
+ return " ORDER BY $sql $sort";
+ }
}
-function tablesort($cell, $header) {
- $ts = tablesort_init($header);
- $title = t("sort by %s", array("%s" => $cell['data']));
-
+function tablesort_header($cell, $header, $ts) {
// special formatting for the currently sorted column header
- if ($cell['data'] == $ts['name']) {
- $ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc');
- $cell['class'] = 'active';
- $image = '&nbsp;<img src="' . theme('image', 'arrow-' . $ts['sort'] . '.gif') . '" alt="'. t('sort icon') .'" />';
- $title = ($ts['sort'] == 'asc' ? t("sort ascending") : t("sort descending"));
- }
- else {
- // If the user clicks a different header, we want to sort ascending initially.
- $ts['sort'] = "asc";
- }
+ if (is_array($cell) && $cell['field']) {
+ if ($cell['data'] == $ts['name']) {
+ $ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc');
+ $cell['class'] = 'active';
+ $image = '&nbsp;<img src="' . theme('image', 'arrow-' . $ts['sort'] . '.gif') . '" alt="'. t('sort icon') .'" />';
+ $title = ($ts['sort'] == 'asc' ? t('sort ascending') : t('sort descending'));
+ }
+ else {
+ // If the user clicks a different header, we want to sort ascending initially.
+ $ts['sort'] = 'asc';
+ }
+ $title = t('sort by %s', array('%s' => $cell['data']));
+ $cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), "sort=". $ts['sort']. "&amp;order=". urlencode($cell['data']). $ts['query_string']);
- $cell['data'] = l($cell['data'] . $image, $_GET['q'], array("title" => $title), "sort=". $ts['sort']. "&amp;order=". urlencode($cell['data']). $ts['query_string']);
+ unset($cell['field'], $cell['sort']);
+ }
+ return $cell;
+}
- unset($cell['field'], $cell['sort']);
+function tablesort_cell($cell, $header, $ts, $i) {
+ if ($header[$i]['data'] == $ts['name'] && $header[$i]['field']) {
+ if (is_array($cell)) {
+ $cell['class'] .= ' active';
+ }
+ else {
+ $cell = array('data' => $cell, 'class' => 'active');
+ }
+ }
return $cell;
}
@@ -51,7 +60,7 @@ function tablesort_get_querystring() {
$cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
foreach ($cgi as $key => $val) {
if ($key != 'order' && $key != 'sort' && $key != 'q') {
- $query_string .= "&amp;". $key ."=". $val;
+ $query_string .= '&amp;'. $key .'='. $val;
}
}
return $query_string;
@@ -67,6 +76,7 @@ function tablesort_get_order($headers) {
if ($header['sort'] == 'asc' || $header['sort'] == 'desc') {
$default = array('name' => $header['data'], 'sql' => $header['field']);
}
+ $i++;
}
if ($default) {
@@ -75,7 +85,7 @@ function tablesort_get_order($headers) {
else {
// The first column specified is initial 'order by' field unless otherwise specified
if (is_array($headers[0])) {
- return array('name' => $headers[0]['name'], 'sql' => $headers[0]['field']);
+ return array('name' => $headers[0]['data'], 'sql' => $headers[0]['field']);
}
else {
return array('name' => $headers[0]);
diff --git a/includes/theme.inc b/includes/theme.inc
index b66cccb01..31c01afca 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -322,9 +322,7 @@ function theme_table($header, $rows, $attributes = NULL) {
$ts = tablesort_init($header);
$output .= " <tr>";
foreach ($header as $cell) {
- if (is_array($cell) && $cell['field']) {
- $cell = tablesort($cell, $header);
- }
+ $cell = tablesort_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, 1);
}
$output .= " </tr>\n";
@@ -345,14 +343,7 @@ function theme_table($header, $rows, $attributes = NULL) {
}
foreach ($row as $cell) {
- if ($header[$i]['data'] == $ts['name'] && $header[$i]['field']) {
- if (is_array($cell)) {
- $cell['class'] .= ' active';
- }
- else {
- $cell = array('data' => $cell, 'class' => 'active');
- }
- }
+ $cell = tablesort_cell($cell, $header, $ts, $i);
$output .= _theme_table_cell($cell, 0);
$i++;
}
diff --git a/misc/drupal.css b/misc/drupal.css
index 9a51f7527..6d514b607 100644
--- a/misc/drupal.css
+++ b/misc/drupal.css
@@ -31,17 +31,18 @@ th {
border-bottom: 3px solid #ccc;
white-space: nowrap;
}
-tr.dark {
- background-color: #ddd;
+th.active img {
+ display: inline;
}
-tr.light {
+tr.dark, tr.light {
background-color: #eee;
+ border-bottom: 1px solid #ccc;
}
tr.dark td, tr.light td {
padding: 0.1em 0.6em;
}
-th.active img {
- display: inline;
+td.active {
+ background-color: #ddd;
}
/*
@@ -383,4 +384,4 @@ td.watchdog-httpd {
td.watchdog-error {
background: #e44;
border: 1px solid #c22;
-}
+} \ No newline at end of file
diff --git a/modules/comment.module b/modules/comment.module
index 86ac2d363..03ab6b0b8 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1017,7 +1017,14 @@ function comment_admin_overview($status = 0) {
while ($comment = db_fetch_object($result)) {
$comment->name = $comment->registered_name ? $comment->registered_name : $comment->name;
- $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid", array("title" => htmlspecialchars(truncate_utf8($comment->comment, 128))), NULL, "comment-$comment->cid") ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid"));
+ $rows[] = array(
+ l($comment->subject, "node/view/$comment->nid/$comment->cid", array("title" => htmlspecialchars(truncate_utf8($comment->comment, 128))), NULL, "comment-$comment->cid") ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : ""),
+ format_name($comment),
+ ($comment->status == 0 ? t("published") : t("not published")),
+ format_date($comment->timestamp, "small"),
+ l(t("edit comment"), "admin/comment/edit/$comment->cid"),
+ l(t("delete comment"), "admin/comment/delete/$comment->cid")
+ );
}
if ($pager = theme("pager", NULL, 50, 0, tablesort_pager())) {
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 86ac2d363..03ab6b0b8 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1017,7 +1017,14 @@ function comment_admin_overview($status = 0) {
while ($comment = db_fetch_object($result)) {
$comment->name = $comment->registered_name ? $comment->registered_name : $comment->name;
- $rows[] = array(l($comment->subject, "node/view/$comment->nid/$comment->cid", array("title" => htmlspecialchars(truncate_utf8($comment->comment, 128))), NULL, "comment-$comment->cid") ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : ""), format_name($comment), ($comment->status == 0 ? t("published") : t("not published")) ."</td><td>". format_date($comment->timestamp, "small") ."</td><td>". l(t("edit comment"), "admin/comment/edit/$comment->cid"), l(t("delete comment"), "admin/comment/delete/$comment->cid"));
+ $rows[] = array(
+ l($comment->subject, "node/view/$comment->nid/$comment->cid", array("title" => htmlspecialchars(truncate_utf8($comment->comment, 128))), NULL, "comment-$comment->cid") ." ". (node_is_new($comment->nid, $comment->timestamp) ? theme("mark") : ""),
+ format_name($comment),
+ ($comment->status == 0 ? t("published") : t("not published")),
+ format_date($comment->timestamp, "small"),
+ l(t("edit comment"), "admin/comment/edit/$comment->cid"),
+ l(t("delete comment"), "admin/comment/delete/$comment->cid")
+ );
}
if ($pager = theme("pager", NULL, 50, 0, tablesort_pager())) {
diff --git a/themes/xtemplate/default/xtemplate.css b/themes/xtemplate/default/xtemplate.css
index 51dc99cfc..67994520a 100644
--- a/themes/xtemplate/default/xtemplate.css
+++ b/themes/xtemplate/default/xtemplate.css
@@ -10,12 +10,6 @@ body {
background-color: #fff;
font: 76% Verdana, Arial, Helvetica, sans-serif;
}
-tr.dark {
- background-color: #ddd;
-}
-tr.light {
- background-color: #eee;
-}
tr.dark td, tr.light td {
padding: 0.3em;
}
diff --git a/themes/xtemplate/pushbutton/xtemplate.css b/themes/xtemplate/pushbutton/xtemplate.css
index 19093e3aa..9c82bff5d 100644
--- a/themes/xtemplate/pushbutton/xtemplate.css
+++ b/themes/xtemplate/pushbutton/xtemplate.css
@@ -24,12 +24,6 @@ img {
display: block;
border: 0;
}
-tr.dark {
- background-color: #ddd;
-}
-tr.light {
- background-color: #eee;
-}
tr.dark td, tr.light td {
padding: 0.3em;
}