| 1 |
Index: includes/tablesort.inc
|
| 2 |
===================================================================
|
| 3 |
RCS file: /cvs/drupal/drupal/includes/tablesort.inc,v
|
| 4 |
retrieving revision 1.36
|
| 5 |
diff -u -r1.36 tablesort.inc
|
| 6 |
--- includes/tablesort.inc 25 Aug 2005 21:14:16 -0000 1.36
|
| 7 |
+++ includes/tablesort.inc 31 Aug 2005 23:43:12 -0000
|
| 8 |
@@ -20,6 +20,32 @@
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
+ * Set-up required attributes for Ajax tablesort and return whether we are
|
| 13 |
+ * currently handling an Ajax request.
|
| 14 |
+ */
|
| 15 |
+function tablesort_ajax($header, &$attributes) {
|
| 16 |
+ // Tables with an id can be sorted through Ajax
|
| 17 |
+ if (isset($attributes['id'])) {
|
| 18 |
+ // Determine if there are any sortable columns.
|
| 19 |
+ $tablesort = false;
|
| 20 |
+ foreach ($header as $item) {
|
| 21 |
+ if (is_array($item) && isset($item['field'])) {
|
| 22 |
+ $tablesort = true;
|
| 23 |
+ break;
|
| 24 |
+ }
|
| 25 |
+ }
|
| 26 |
+ // Mark the table if needed
|
| 27 |
+ if ($tablesort) {
|
| 28 |
+ drupal_add_js('misc/tablesort.js');
|
| 29 |
+ $attributes['class'] = trim($attributes['class'] .' tablesort');
|
| 30 |
+ // Are we currently handling an Ajax request for this table?
|
| 31 |
+ return $_GET['tablesort'] == $attributes['id'];
|
| 32 |
+ }
|
| 33 |
+ }
|
| 34 |
+ return FALSE;
|
| 35 |
+}
|
| 36 |
+
|
| 37 |
+/**
|
| 38 |
* Fetch pager link arguments.
|
| 39 |
*
|
| 40 |
* When producing a sortable table that presents paged data, pass the output
|
| 41 |
@@ -87,7 +113,7 @@
|
| 42 |
$image = '';
|
| 43 |
}
|
| 44 |
$cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']). $ts['query_string'], NULL, FALSE, TRUE);
|
| 45 |
-
|
| 46 |
+ $cell['class'] = trim($cell['class'] .' tablesort');
|
| 47 |
unset($cell['field'], $cell['sort']);
|
| 48 |
}
|
| 49 |
return $cell;
|
| 50 |
Index: includes/theme.inc
|
| 51 |
===================================================================
|
| 52 |
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
|
| 53 |
retrieving revision 1.256
|
| 54 |
diff -u -r1.256 theme.inc
|
| 55 |
--- includes/theme.inc 28 Aug 2005 15:29:34 -0000 1.256
|
| 56 |
+++ includes/theme.inc 31 Aug 2005 23:43:12 -0000
|
| 57 |
@@ -692,15 +692,20 @@
|
| 58 |
*
|
| 59 |
* @param $attributes
|
| 60 |
* An array of HTML attributes to apply to the table tag.
|
| 61 |
+ * @param $ajax
|
| 62 |
+ * Whether this table should be sorted using Ajax. If set to TRUE, you must
|
| 63 |
+ * pass a valid $attributes['id'].
|
| 64 |
* @return
|
| 65 |
* An HTML string representing the table.
|
| 66 |
*/
|
| 67 |
function theme_table($header, $rows, $attributes = NULL) {
|
| 68 |
-
|
| 69 |
+ // Initialize Ajax tablesort
|
| 70 |
+ $shortcircuit = tablesort_ajax($header, $attributes);
|
| 71 |
$output = '<table'. drupal_attributes($attributes) .">\n";
|
| 72 |
|
| 73 |
// Format the table header:
|
| 74 |
if (count($header)) {
|
| 75 |
+ // Note: tablesort_init() may modify $attributes
|
| 76 |
$ts = tablesort_init($header);
|
| 77 |
$output .= ' <tr>';
|
| 78 |
foreach ($header as $cell) {
|
| 79 |
@@ -751,6 +756,13 @@
|
| 80 |
}
|
| 81 |
|
| 82 |
$output .= "</table>\n";
|
| 83 |
+
|
| 84 |
+ // Print table directly if doing an Ajax request for this table
|
| 85 |
+ if ($shortcircuit) {
|
| 86 |
+ print $output;
|
| 87 |
+ exit;
|
| 88 |
+ }
|
| 89 |
+
|
| 90 |
return $output;
|
| 91 |
}
|
| 92 |
|
| 93 |
cvs diff: Diffing misc
|
| 94 |
Index: misc/drupal.css
|
| 95 |
===================================================================
|
| 96 |
RCS file: /cvs/drupal/drupal/misc/drupal.css,v
|
| 97 |
retrieving revision 1.116
|
| 98 |
diff -u -r1.116 drupal.css
|
| 99 |
--- misc/drupal.css 31 Aug 2005 21:17:26 -0000 1.116
|
| 100 |
+++ misc/drupal.css 31 Aug 2005 23:43:12 -0000
|
| 101 |
@@ -570,6 +570,7 @@
|
| 102 |
background: #0072b9;
|
| 103 |
color: #fff;
|
| 104 |
}
|
| 105 |
+
|
| 106 |
/* Animated throbber */
|
| 107 |
html.js input.form-autocomplete {
|
| 108 |
background: url('throbber.gif') no-repeat 100% 2px;
|
| 109 |
@@ -577,6 +578,12 @@
|
| 110 |
html.js input.throbbing {
|
| 111 |
background-position: 100% -18px;
|
| 112 |
}
|
| 113 |
+html.js th.tablesort {
|
| 114 |
+ padding-right: 18px;
|
| 115 |
+}
|
| 116 |
+html.js th.throbbing {
|
| 117 |
+ background: url('throbber.gif') no-repeat 100% -18px;
|
| 118 |
+}
|
| 119 |
|
| 120 |
/*
|
| 121 |
** Progressbar styles
|
| 122 |
Index: misc/tablesort.js
|
| 123 |
===================================================================
|
| 124 |
RCS file: misc/tablesort.js
|
| 125 |
diff -N misc/tablesort.js
|
| 126 |
--- /dev/null 1 Jan 1970 00:00:00 -0000
|
| 127 |
+++ misc/tablesort.js 31 Aug 2005 23:43:12 -0000
|
| 128 |
@@ -0,0 +1,97 @@
|
| 129 |
+// $Id$
|
| 130 |
+
|
| 131 |
+if (isJsEnabled()) {
|
| 132 |
+ addLoadEvent(tablesortAutoAttach);
|
| 133 |
+}
|
| 134 |
+
|
| 135 |
+/**
|
| 136 |
+ * Attach the tablesort behaviour to specially marked tables.
|
| 137 |
+ */
|
| 138 |
+function tablesortAutoAttach() {
|
| 139 |
+ var tables = document.getElementsByTagName('table');
|
| 140 |
+ var header, table;
|
| 141 |
+ // Find specially marked tables
|
| 142 |
+ for (var i = 0; table = tables[i]; i++) {
|
| 143 |
+ if (!hasClass(table, 'tablesort')) {
|
| 144 |
+ continue;
|
| 145 |
+ }
|
| 146 |
+ var ts = new tablesort(table);
|
| 147 |
+ // Find all the header cells
|
| 148 |
+ headers = table.getElementsByTagName('th');
|
| 149 |
+ if (headers.length == 0) {
|
| 150 |
+ continue;
|
| 151 |
+ }
|
| 152 |
+ for (var j = 0; header = headers[j]; j++) {
|
| 153 |
+ // Find the first link
|
| 154 |
+ var links = header.getElementsByTagName('a');
|
| 155 |
+ if (links.length == 0) {
|
| 156 |
+ continue;
|
| 157 |
+ }
|
| 158 |
+ var link = links[0];
|
| 159 |
+ // Install onclick override
|
| 160 |
+ link.onclick = function() {
|
| 161 |
+ ts.doSort(this);
|
| 162 |
+ this.blur();
|
| 163 |
+ this.onclick = function() {
|
| 164 |
+ return false;
|
| 165 |
+ }
|
| 166 |
+ return false;
|
| 167 |
+ }
|
| 168 |
+ }
|
| 169 |
+ // Tablesorted pagers
|
| 170 |
+ var divs = table.getElementsByTagName('div');
|
| 171 |
+ var div;
|
| 172 |
+ for (var j = 0; div = divs[j]; j++) {
|
| 173 |
+ if (div.id != 'pager') {
|
| 174 |
+ continue;
|
| 175 |
+ }
|
| 176 |
+ var links = div.getElementsByTagName('a');
|
| 177 |
+ var link;
|
| 178 |
+ for (var k = 0; link = links[k]; k++) {
|
| 179 |
+ // Install onclick override
|
| 180 |
+ link.onclick = function() {
|
| 181 |
+ ts.doSort(this);
|
| 182 |
+ this.blur();
|
| 183 |
+ this.onclick = function() {
|
| 184 |
+ return false;
|
| 185 |
+ }
|
| 186 |
+ return false;
|
| 187 |
+ }
|
| 188 |
+ }
|
| 189 |
+ }
|
| 190 |
+ }
|
| 191 |
+}
|
| 192 |
+
|
| 193 |
+/**
|
| 194 |
+ * A tablesort object tied to a particular <table>.
|
| 195 |
+ */
|
| 196 |
+function tablesort(table) {
|
| 197 |
+ var ts = this;
|
| 198 |
+ this.table = table;
|
| 199 |
+}
|
| 200 |
+
|
| 201 |
+/**
|
| 202 |
+ * Sort the table by a new column
|
| 203 |
+ */
|
| 204 |
+tablesort.prototype.doSort = function (link) {
|
| 205 |
+ var header = link.parentNode;
|
| 206 |
+ this.uri = link.href + '&tablesort=' + escape(this.table.id);
|
| 207 |
+ addClass(header, 'throbbing');
|
| 208 |
+ HTTPGet(this.uri, this.receiveSort, this);
|
| 209 |
+}
|
| 210 |
+
|
| 211 |
+/**
|
| 212 |
+ * HTTP callback function. Replaces the entire table with the new one.
|
| 213 |
+ */
|
| 214 |
+tablesort.prototype.receiveSort = function(string, xmlhttp, ts) {
|
| 215 |
+ if (xmlhttp.status != 200) {
|
| 216 |
+ return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ ts.uri);
|
| 217 |
+ }
|
| 218 |
+ // Create DOM node for new table
|
| 219 |
+ var div = document.createElement('div');
|
| 220 |
+ div.innerHTML = string;
|
| 221 |
+ // Replace old table
|
| 222 |
+ ts.table.parentNode.replaceChild(div, ts.table);
|
| 223 |
+ // Re-attach behaviour
|
| 224 |
+ tablesortAutoAttach();
|
| 225 |
+}
|
| 226 |
cvs diff: Diffing modules
|
| 227 |
Index: modules/comment.module
|
| 228 |
===================================================================
|
| 229 |
RCS file: /cvs/drupal/drupal/modules/comment.module,v
|
| 230 |
retrieving revision 1.368
|
| 231 |
diff -u -r1.368 comment.module
|
| 232 |
--- modules/comment.module 30 Aug 2005 15:22:29 -0000 1.368
|
| 233 |
+++ modules/comment.module 31 Aug 2005 23:43:17 -0000
|
| 234 |
@@ -1036,7 +1036,7 @@
|
| 235 |
$rows[] = array(array('data' => t('No comments available.'), 'colspan' => '6'));
|
| 236 |
}
|
| 237 |
|
| 238 |
- return theme('table', $header, $rows);
|
| 239 |
+ return theme('table', $header, $rows, array('id' => 'comment-admin-overview'));
|
| 240 |
}
|
| 241 |
|
| 242 |
/**
|
| 243 |
Index: modules/forum.module
|
| 244 |
===================================================================
|
| 245 |
RCS file: /cvs/drupal/drupal/modules/forum.module,v
|
| 246 |
retrieving revision 1.266
|
| 247 |
diff -u -r1.266 forum.module
|
| 248 |
--- modules/forum.module 30 Aug 2005 15:22:29 -0000 1.266
|
| 249 |
+++ modules/forum.module 31 Aug 2005 23:43:19 -0000
|
| 250 |
@@ -953,7 +953,7 @@
|
| 251 |
}
|
| 252 |
}
|
| 253 |
|
| 254 |
- $output .= theme('table', $forum_topic_list_header, $rows);
|
| 255 |
+ $output .= theme('table', $forum_topic_list_header, $rows, array('id' => 'forum-topic-list'));
|
| 256 |
|
| 257 |
return $output;
|
| 258 |
}
|
| 259 |
Index: modules/node.module
|
| 260 |
===================================================================
|
| 261 |
RCS file: /cvs/drupal/drupal/modules/node.module,v
|
| 262 |
retrieving revision 1.526
|
| 263 |
diff -u -r1.526 node.module
|
| 264 |
--- modules/node.module 30 Aug 2005 15:22:29 -0000 1.526
|
| 265 |
+++ modules/node.module 31 Aug 2005 23:43:24 -0000
|
| 266 |
@@ -920,6 +920,14 @@
|
| 267 |
$output .= form_group(t('Show only items where'), $form);
|
| 268 |
|
| 269 |
// Build query
|
| 270 |
+ $header = array(NULL,
|
| 271 |
+ array('data' => t('Title'), 'field' => 'n.title'),
|
| 272 |
+ array('data' => t('Type'), 'field' => 'n.type'),
|
| 273 |
+ array('data' => t('Author'), 'field' => 'u.name'),
|
| 274 |
+ array('data' => t('Status'), 'field' => 'n.status'),
|
| 275 |
+ array('data' => t('Last Updated'), 'field' => 'n.changed', 'sort' => 'desc'),
|
| 276 |
+ t('Operations'));
|
| 277 |
+
|
| 278 |
$where = $args = array();
|
| 279 |
$join = '';
|
| 280 |
foreach ($session as $filter) {
|
| 281 |
@@ -936,7 +944,7 @@
|
| 282 |
$join .= $filters[$key]['join'];
|
| 283 |
}
|
| 284 |
$where = count($where) ? 'WHERE '. implode(' AND ', $where) : '';
|
| 285 |
- $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $join .' INNER JOIN {users} u ON n.uid = u.uid '. $where .' ORDER BY n.changed DESC', 50, 0, NULL, $args);
|
| 286 |
+ $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $join .' INNER JOIN {users} u ON n.uid = u.uid '. $where . tablesort_sql($header), 50, 0, NULL, $args);
|
| 287 |
|
| 288 |
// Make sure the update controls are disabled if we don't have any rows to select from.
|
| 289 |
$disabled = !db_num_rows($result);
|
| 290 |
@@ -953,8 +961,6 @@
|
| 291 |
$output .= '</div>';
|
| 292 |
|
| 293 |
// Overview table:
|
| 294 |
- $header = array(NULL, t('Title'), t('Type'), t('Author'), t('Status'), t('Operations'));
|
| 295 |
-
|
| 296 |
$destination = drupal_get_destination();
|
| 297 |
while ($node = db_fetch_object($result)) {
|
| 298 |
$rows[] = array(form_checkbox(NULL, 'nodes]['. $node->nid, 1, 0),
|
| 299 |
@@ -962,6 +968,7 @@
|
| 300 |
node_get_name($node),
|
| 301 |
theme('username', $node),
|
| 302 |
($node->status ? t('published') : t('not published')),
|
| 303 |
+ format_date($node->created, 'small'),
|
| 304 |
l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination));
|
| 305 |
}
|
| 306 |
|
| 307 |
@@ -973,7 +980,7 @@
|
| 308 |
$rows[] = array(array('data' => t('No posts available.'), 'colspan' => '6'));
|
| 309 |
}
|
| 310 |
|
| 311 |
- $output .= theme('table', $header, $rows);
|
| 312 |
+ $output .= theme('table', $header, $rows, array('id' => 'node-admin-nodes'));
|
| 313 |
return form($output, 'post', url('admin/node/action'));
|
| 314 |
}
|
| 315 |
|
| 316 |
Index: modules/path.module
|
| 317 |
===================================================================
|
| 318 |
RCS file: /cvs/drupal/drupal/modules/path.module,v
|
| 319 |
retrieving revision 1.62
|
| 320 |
diff -u -r1.62 path.module
|
| 321 |
--- modules/path.module 25 Aug 2005 21:14:16 -0000 1.62
|
| 322 |
+++ modules/path.module 31 Aug 2005 23:43:25 -0000
|
| 323 |
@@ -277,7 +277,7 @@
|
| 324 |
$rows[] = array(array('data' => t('No URL aliases available.'), 'colspan' => '4'));
|
| 325 |
}
|
| 326 |
|
| 327 |
- return theme('table', $header, $rows);
|
| 328 |
+ return theme('table', $header, $rows, array('id' => 'path-overview'));
|
| 329 |
}
|
| 330 |
|
| 331 |
/**
|
| 332 |
Index: modules/statistics.module
|
| 333 |
===================================================================
|
| 334 |
RCS file: /cvs/drupal/drupal/modules/statistics.module,v
|
| 335 |
retrieving revision 1.204
|
| 336 |
diff -u -r1.204 statistics.module
|
| 337 |
--- modules/statistics.module 25 Aug 2005 21:14:17 -0000 1.204
|
| 338 |
+++ modules/statistics.module 31 Aug 2005 23:43:26 -0000
|
| 339 |
@@ -182,7 +182,7 @@
|
| 340 |
}
|
| 341 |
|
| 342 |
drupal_set_title(check_plain($node->title));
|
| 343 |
- return theme('table', $header, $rows);
|
| 344 |
+ return theme('table', $header, $rows, array('id' => 'statistics-node-tracker'));
|
| 345 |
}
|
| 346 |
else {
|
| 347 |
drupal_not_found();
|
| 348 |
@@ -210,7 +210,7 @@
|
| 349 |
}
|
| 350 |
|
| 351 |
drupal_set_title($account->name);
|
| 352 |
- return theme('table', $header, $rows);
|
| 353 |
+ return theme('table', $header, $rows, array('id' => 'statistics-user-tracker'));
|
| 354 |
}
|
| 355 |
else {
|
| 356 |
drupal_not_found();
|
| 357 |
@@ -243,7 +243,7 @@
|
| 358 |
$rows[] = array(array('data' => $pager, 'colspan' => '4'));
|
| 359 |
}
|
| 360 |
|
| 361 |
- return theme('table', $header, $rows);
|
| 362 |
+ return theme('table', $header, $rows, array('id' => 'statistics-recent-hits'));
|
| 363 |
}
|
| 364 |
|
| 365 |
/**
|
| 366 |
@@ -271,7 +271,7 @@
|
| 367 |
}
|
| 368 |
|
| 369 |
drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
|
| 370 |
- return theme('table', $header, $rows);
|
| 371 |
+ return theme('table', $header, $rows, array('id' => 'statistics-top-pages'));
|
| 372 |
}
|
| 373 |
|
| 374 |
/**
|
| 375 |
@@ -301,7 +301,7 @@
|
| 376 |
}
|
| 377 |
|
| 378 |
drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
|
| 379 |
- return theme('table', $header, $rows);
|
| 380 |
+ return theme('table', $header, $rows, array('id' => 'statistics-top-visitors'));
|
| 381 |
}
|
| 382 |
|
| 383 |
/**
|
| 384 |
@@ -328,7 +328,7 @@
|
| 385 |
$rows[] = array(array('data' => $pager, 'colspan' => '3'));
|
| 386 |
}
|
| 387 |
|
| 388 |
- return theme('table', $header, $rows);
|
| 389 |
+ return theme('table', $header, $rows, array('id' => 'statistics-top-referrers'));
|
| 390 |
}
|
| 391 |
|
| 392 |
/**
|
| 393 |
Index: modules/user.module
|
| 394 |
===================================================================
|
| 395 |
RCS file: /cvs/drupal/drupal/modules/user.module,v
|
| 396 |
retrieving revision 1.502
|
| 397 |
diff -u -r1.502 user.module
|
| 398 |
--- modules/user.module 25 Aug 2005 21:14:17 -0000 1.502
|
| 399 |
+++ modules/user.module 31 Aug 2005 23:43:36 -0000
|
| 400 |
@@ -1734,7 +1734,7 @@
|
| 401 |
if (!empty($pager)) {
|
| 402 |
$rows[] = array(array('data' => $pager, 'colspan' => '5'));
|
| 403 |
}
|
| 404 |
- return theme('table', $header, $rows);
|
| 405 |
+ return theme('table', $header, $rows, array('id' => 'user-admin-account'));
|
| 406 |
}
|
| 407 |
|
| 408 |
function user_configure() {
|
| 409 |
Index: modules/watchdog.module
|
| 410 |
===================================================================
|
| 411 |
RCS file: /cvs/drupal/drupal/modules/watchdog.module,v
|
| 412 |
retrieving revision 1.126
|
| 413 |
diff -u -r1.126 watchdog.module
|
| 414 |
--- modules/watchdog.module 25 Aug 2005 21:14:17 -0000 1.126
|
| 415 |
+++ modules/watchdog.module 31 Aug 2005 23:43:36 -0000
|
| 416 |
@@ -123,7 +123,7 @@
|
| 417 |
}
|
| 418 |
|
| 419 |
$output = '<div class="container-inline">'. form($form) .'</div>';
|
| 420 |
- $output .= theme('table', $header, $rows);
|
| 421 |
+ $output .= theme('table', $header, $rows, array('id' => 'watchdog-overview'));
|
| 422 |
|
| 423 |
return $output;
|
| 424 |
}
|