diff --git a/workspace.module b/workspace.module index 587bdd7..bc1e4d6 100644 --- a/workspace.module +++ b/workspace.module @@ -237,6 +237,8 @@ function workspace_list_content($account) { array('data' => t('Operations'), 'colspan' => 2) ); $result = pager_query(db_rewrite_sql($sql . tablesort_sql($header)), $max, 0, db_rewrite_sql($count_sql), $account->uid); + $pager = theme('pager', NULL, $max); + $rows = workspace_build_rows($result, $account); $output = ''; // Only add the content add form if the user is viewing his/her own workspace. @@ -244,7 +246,7 @@ function workspace_list_content($account) { $output = drupal_get_form('workspace_add_form'); } - $output .= theme_workspace_list($header, $rows, $max); + $output .= theme('workspace_list', $header, $rows, $max, $pager); return $output; } @@ -273,8 +275,10 @@ function workspace_list_comments($account) { array('data' => t('Operations'), 'colspan' => 2) ); $result = pager_query($sql . tablesort_sql($header), $max, 0, $count_sql, $account->uid); + $pager = theme('pager', NULL, $max); + $rows = workspace_build_rows($result, $account); - return theme_workspace_list($header, $rows, $max); + return theme('workspace_list', $header, $rows, $max, $pager); } /** @@ -385,6 +389,7 @@ function workspace_list_files($account) { LEFT JOIN {upload} u ON f.fid = u.fid WHERE f.uid = %d"; $result = pager_query($sql . tablesort_sql($header), $max, 2, NULL, $account->uid); + $pager = theme('pager', NULL, $max); while ($row = db_fetch_object($result)) { $rows[] = array( @@ -396,7 +401,7 @@ function workspace_list_files($account) { ); } - return theme('workspace_list', $header, $rows, $max); + return theme('workspace_list', $header, $rows, $max, $pager); } /** @@ -405,21 +410,20 @@ function workspace_list_files($account) { function workspace_theme() { return array( 'workspace_list' => array( - 'arguments' => array('header' => array(), 'rows' => array(), $max = 50), + 'arguments' => array('header' => array(), 'rows' => array(), $max => 50, 'pager' => NULL), ), - ); + ); } /** * Theme the list of content. Turn the results into a table. */ -function theme_workspace_list($header, $rows, $max) { +function theme_workspace_list($header, $rows, $max, $pager) { if ($rows) { - $pager = theme('pager', NULL, $max, 2); + $output .= theme('table', $header, $rows); if (!empty($pager)) { - $rows[] = array(array('data' => $pager, 'colspan' => 3)); + $output = $pager . $output . $pager; } - $output .= theme('table', $header, $rows); } else { $output = t('Your workspace is currently empty.'); @@ -547,4 +551,4 @@ function workspace_user($op, &$edit, &$account) { ); } } -} \ No newline at end of file +}