diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-12-02 14:56:32 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-12-02 14:56:32 +0000 |
commit | 92760988b9decb01831ba89bcc54056a702c3836 (patch) | |
tree | 4a27865ed1737d832e82a575521940503147cd43 | |
parent | e7dedc4330f3d7bbc4fd861a4e5619d780bcca6c (diff) | |
download | brdo-92760988b9decb01831ba89bcc54056a702c3836.tar.gz brdo-92760988b9decb01831ba89bcc54056a702c3836.tar.bz2 |
- Patch #648410 by Dave Reid: standardize add 'empty' row functionality to all tables.
-rw-r--r-- | includes/common.inc | 2 | ||||
-rw-r--r-- | includes/form.inc | 11 | ||||
-rw-r--r-- | includes/locale.inc | 11 | ||||
-rw-r--r-- | includes/theme.inc | 8 | ||||
-rw-r--r-- | modules/aggregator/aggregator.admin.inc | 10 | ||||
-rw-r--r-- | modules/book/book.admin.inc | 8 | ||||
-rw-r--r-- | modules/dblog/dblog.admin.inc | 10 | ||||
-rw-r--r-- | modules/locale/locale.test | 24 | ||||
-rw-r--r-- | modules/node/content_types.inc | 9 | ||||
-rw-r--r-- | modules/node/node.admin.inc | 9 | ||||
-rw-r--r-- | modules/path/path.admin.inc | 8 | ||||
-rw-r--r-- | modules/profile/profile.admin.inc | 5 | ||||
-rw-r--r-- | modules/statistics/statistics.admin.inc | 20 | ||||
-rw-r--r-- | modules/statistics/statistics.pages.inc | 14 | ||||
-rw-r--r-- | modules/system/system.admin.inc | 13 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.admin.inc | 8 | ||||
-rw-r--r-- | modules/tracker/tracker.pages.inc | 6 |
17 files changed, 51 insertions, 125 deletions
diff --git a/includes/common.inc b/includes/common.inc index 9f8b6a66b..ee1b10c2c 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -5427,7 +5427,7 @@ function drupal_common_theme() { 'variables' => array('links' => NULL), ), 'table' => array( - 'variables' => array('header' => NULL, 'rows' => NULL, 'attributes' => array(), 'caption' => NULL, 'colgroups' => array(), 'sticky' => TRUE), + 'variables' => array('header' => NULL, 'rows' => NULL, 'attributes' => array(), 'caption' => NULL, 'colgroups' => array(), 'sticky' => TRUE, 'empty' => ''), ), 'table_select_header_cell' => array( 'variables' => array(), diff --git a/includes/form.inc b/includes/form.inc index 39090a349..6e992e5c6 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -2338,6 +2338,7 @@ function theme_container($variables) { function theme_tableselect($variables) { $element = $variables['element']; $rows = array(); + $header = $element['#header']; if (!empty($element['#options'])) { // Generate a table row for each selectable item in #options. foreach ($element['#options'] as $key => $value) { @@ -2360,15 +2361,9 @@ function theme_tableselect($variables) { // Add an empty header or a "Select all" checkbox to provide room for the // checkboxes/radios in the first table column. $first_col = $element['#js_select'] ? array(theme('table_select_header_cell')) : array(''); - $header = array_merge($first_col, $element['#header']); + $header = array_merge($first_col, $header); } - else { - // If there are no selectable options, display the empty text over the - // entire width of the table. - $header = $element['#header']; - $rows[] = array(array('data' => $element['#empty'], 'colspan' => count($header))); - } - return theme('table', array('header' => $header, 'rows' => $rows)); + return theme('table', array('header' => $header, 'rows' => $rows, 'empty' => $element['#empty'])); } /** diff --git a/includes/locale.inc b/includes/locale.inc index 1dae9c722..fe01cbd3d 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -2801,15 +2801,8 @@ function _locale_translate_seek() { ); } - if (count($rows)) { - $output .= theme('table', array('header' => $header, 'rows' => $rows)); - if ($pager = theme('pager', array('tags' => NULL))) { - $output .= $pager; - } - } - else { - $output .= t('No strings found for your search.'); - } + $output .= theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No strings available.'))); + $output .= theme('pager', array('tags' => NULL)); return $output; } diff --git a/includes/theme.inc b/includes/theme.inc index 63af79711..635b2b0bb 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1706,6 +1706,8 @@ function theme_submenu($variables) { * within a table. For example, one may easily group three columns and * apply same background style to all. * - sticky: Use a "sticky" table header. + * - empty: The message to display in an extra row if table does not have any + * rows. * * @return * An HTML string representing the table. @@ -1717,6 +1719,7 @@ function theme_table($variables) { $caption = $variables['caption']; $colgroups = $variables['colgroups']; $sticky = $variables['sticky']; + $empty = $variables['empty']; // Add sticky headers, if applicable. if (count($header) && $sticky) { @@ -1784,6 +1787,11 @@ function theme_table($variables) { $ts = array(); } + // Add the 'empty' row message if available. + if (!count($rows) && $empty) { + $rows[] = array(array('data' => $empty, 'colspan' => count($header), 'class' => array('empty', 'message'))); + } + // Format the table rows: if (count($rows)) { $output .= "<tbody>\n"; diff --git a/modules/aggregator/aggregator.admin.inc b/modules/aggregator/aggregator.admin.inc index 90ef11d32..61ef84802 100644 --- a/modules/aggregator/aggregator.admin.inc +++ b/modules/aggregator/aggregator.admin.inc @@ -29,10 +29,7 @@ function aggregator_view() { foreach ($result as $feed) { $rows[] = array(l($feed->title, "aggregator/sources/$feed->fid"), format_plural($feed->items, '1 item', '@count items'), ($feed->checked ? t('@time ago', array('@time' => format_interval(REQUEST_TIME - $feed->checked))) : t('never')), ($feed->checked && $feed->refresh ? t('%time left', array('%time' => format_interval($feed->checked + $feed->refresh - REQUEST_TIME))) : t('never')), l(t('edit'), "admin/config/services/aggregator/edit/feed/$feed->fid"), l(t('remove items'), "admin/config/services/aggregator/remove/$feed->fid"), l(t('update items'), "admin/config/services/aggregator/update/$feed->fid")); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No feeds available. <a href="@link">Add feed</a>.', array('@link' => url('admin/config/services/aggregator/add/feed'))), 'colspan' => '5', 'class' => array('message'))); - } - $output .= theme('table', array('header' => $header, 'rows' => $rows)); + $output .= theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No feeds available.'))); $result = db_query('SELECT c.cid, c.title, COUNT(ci.iid) as items FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid GROUP BY c.cid, c.title ORDER BY title'); @@ -43,10 +40,7 @@ function aggregator_view() { foreach ($result as $category) { $rows[] = array(l($category->title, "aggregator/categories/$category->cid"), format_plural($category->items, '1 item', '@count items'), l(t('edit'), "admin/config/services/aggregator/edit/category/$category->cid")); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No categories available. <a href="@link">Add category</a>.', array('@link' => url('admin/config/services/aggregator/add/category'))), 'colspan' => '5', 'class' => array('message'))); - } - $output .= theme('table', array('header' => $header, 'rows' => $rows)); + $output .= theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No categories available.'))); return $output; } diff --git a/modules/book/book.admin.inc b/modules/book/book.admin.inc index c20aaeb64..81a07637f 100644 --- a/modules/book/book.admin.inc +++ b/modules/book/book.admin.inc @@ -19,12 +19,7 @@ function book_admin_overview() { $rows[] = array(l($book['title'], $book['href'], $book['options']), l(t('edit order and titles'), 'admin/content/book/' . $book['nid'])); } - // If no books were found, let the user know. - if (empty($rows)) { - $rows[] = array(array('data' => t('No books available.'), 'colspan' => 2)); - } - - return theme('table', array('header' => $headers, 'rows' => $rows)); + return theme('table', array('header' => $headers, 'rows' => $rows, 'empty' => t('No books available.'))); } /** @@ -260,4 +255,3 @@ function theme_book_admin_table($variables) { return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'book-outline'))); } - diff --git a/modules/dblog/dblog.admin.inc b/modules/dblog/dblog.admin.inc index c7d09a7b4..7874d0b34 100644 --- a/modules/dblog/dblog.admin.inc +++ b/modules/dblog/dblog.admin.inc @@ -74,15 +74,12 @@ function dblog_overview() { ); } - if (!$rows) { - $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => 6)); - } - $build['dblog_table'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $rows, '#attributes' => array('id' => 'admin-dblog'), + '#empty' => t('No log messages available.'), ); $build['dblog_pager'] = array('#theme' => 'pager'); @@ -120,14 +117,11 @@ function dblog_top($type) { $rows[] = array($dblog->count, truncate_utf8(_dblog_format_message($dblog), 56, TRUE, TRUE)); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => 2)); - } - $build['dblog_top_table'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $rows, + '#empty' => t('No log messages available.'), ); $build['dblog_top_pager'] = array('#theme' => 'pager'); diff --git a/modules/locale/locale.test b/modules/locale/locale.test index 7a4112860..758cc9914 100644 --- a/modules/locale/locale.test +++ b/modules/locale/locale.test @@ -429,7 +429,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings found for your search.'), t("Search didn't find the string.")); + $this->assertText(t('No strings available.'), t("Search didn't find the string.")); // Ensure untranslated string appears if searching on 'only untranslated // strings'. @@ -440,7 +440,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings found for your search.'), t('Search found the string.')); + $this->assertNoText(t('No strings available.'), t('Search found the string.')); // Add translation. // Assume this is the only result, given the random name. @@ -463,7 +463,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings found for your search.'), t('Search found the translation.')); + $this->assertNoText(t('No strings available.'), t('Search found the translation.')); // Ensure translated source string doesn't appear if searching on 'only // untranslated strings'. @@ -474,7 +474,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings found for your search.'), t("Search didn't find the source string.")); + $this->assertText(t('No strings available.'), t("Search didn't find the source string.")); // Ensure translated string doesn't appear if searching on 'only // untranslated strings'. @@ -485,7 +485,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings found for your search.'), t("Search didn't find the translation.")); + $this->assertText(t('No strings available.'), t("Search didn't find the translation.")); // Ensure translated string does appear if searching on the custom language. $search = array( @@ -495,7 +495,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings found for your search.'), t('Search found the translation.')); + $this->assertNoText(t('No strings available.'), t('Search found the translation.')); // Ensure translated string doesn't appear if searching on English. $search = array( @@ -505,7 +505,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings found for your search.'), t("Search didn't find the translation.")); + $this->assertText(t('No strings available.'), t("Search didn't find the translation.")); // Search for a string that isn't in the system. $unavailable_string = $this->randomName(16); @@ -516,7 +516,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings found for your search.'), t("Search didn't find the invalid string.")); + $this->assertText(t('No strings available.'), t("Search didn't find the invalid string.")); } } @@ -612,7 +612,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertText(t('No strings found for your search.'), t('String not overwritten by imported string.')); + $this->assertText(t('No strings available.'), t('String not overwritten by imported string.')); // Try importing a .po file with overriding strings, and ensure existing @@ -632,7 +632,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings found for your search.'), t('String overwritten by imported string.')); + $this->assertNoText(t('No strings available.'), t('String overwritten by imported string.')); } /** @@ -671,7 +671,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase { 'group' => 'all', ); $this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter')); - $this->assertNoText(t('No strings found for your search.'), t('String successfully imported.')); + $this->assertNoText(t('No strings available.'), t('String successfully imported.')); } /** @@ -1797,5 +1797,3 @@ class LocalizeDateFormatsFunctionalTest extends DrupalWebTestCase { $this->assertText($french_date, t('French date format appears')); } } - - diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index 0758c272e..3b21311ae 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -44,14 +44,11 @@ function node_overview_types() { } } - if (empty($rows)) { - $rows[] = array(array('data' => t('No content types available. <a href="@link">Add content type</a>.', array('@link' => url('admin/structure/types/add'))), 'colspan' => '5', 'class' => array('message'))); - } - $build['node_table'] = array( '#theme' => 'table', '#header' => $header, - '#rows' => $rows + '#rows' => $rows, + '#empty' => t('No content types available.'), ); return $build; @@ -130,7 +127,7 @@ function node_type_form($form, &$form_state, $type = NULL) { '#title' => t('Description'), '#type' => 'textarea', '#default_value' => $type->description, - '#description' => t('Describe this content type. It will be displayed on the <em>Add new content</em> page.'), + '#description' => t('Describe this content type. It will be displayed on the <em>Add new content</em> page.'), ); $form['additional_settings'] = array( diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc index 53a82d350..dd4202f2a 100644 --- a/modules/node/node.admin.inc +++ b/modules/node/node.admin.inc @@ -554,18 +554,11 @@ function node_admin_nodes() { } // Otherwise, use a simple table. else { - // Display an empty message like in the tableselect. - if (empty($options)) { - $row = array( - 'data' => t('No content available.'), - 'colspan' => count($header), - ); - $options = array($row); - } $form['nodes'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $options, + '#empty' => t('No content available.'), ); } diff --git a/modules/path/path.admin.inc b/modules/path/path.admin.inc index b1fd47c00..74dde0c8b 100644 --- a/modules/path/path.admin.inc +++ b/modules/path/path.admin.inc @@ -61,15 +61,11 @@ function path_admin_overview($keys = NULL) { $rows[] = $row; } - if (empty($rows)) { - $empty_message = $keys ? t('No URL aliases found.') : t('No URL aliases available. <a href="@link">Add alias</a>.', array('@link' => url('admin/config/search/path/add'))) ; - $rows[] = array(array('data' => $empty_message, 'colspan' => ($multilanguage ? 5 : 4))); - } - $build['path_table'] = array( '#theme' => 'table', '#header' => $header, - '#rows' => $rows + '#rows' => $rows, + '#empty' => t('No URL aliases available.'), ); $build['path_pager'] = array('#theme' => 'pager'); diff --git a/modules/profile/profile.admin.inc b/modules/profile/profile.admin.inc index e54147a8e..c7c103375 100644 --- a/modules/profile/profile.admin.inc +++ b/modules/profile/profile.admin.inc @@ -148,9 +148,6 @@ function theme_profile_admin_overview($variables) { $rows[] = array('data' => $row, 'class' => array('draggable')); } } - if (empty($rows)) { - $rows[] = array(array('data' => t('No fields available.'), 'colspan' => 7)); - } $header = array(t('Title'), t('Name'), t('Type')); if (isset($form['submit'])) { @@ -159,7 +156,7 @@ function theme_profile_admin_overview($variables) { } $header[] = array('data' => t('Operations'), 'colspan' => 2); - $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'profile-fields'))); + $output = theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No fields available.'), 'attributes' => array('id' => 'profile-fields'))); $output .= drupal_render_children($form); return $output; diff --git a/modules/statistics/statistics.admin.inc b/modules/statistics/statistics.admin.inc index 9227e2787..845918883 100644 --- a/modules/statistics/statistics.admin.inc +++ b/modules/statistics/statistics.admin.inc @@ -35,14 +35,11 @@ function statistics_recent_hits() { l(t('details'), "admin/reports/access/$log->aid")); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); - } - $build['statistics_table'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $rows, + '#empty' => t('No statistics available.'), ); $build['statistics_pager'] = array('#theme' => 'pager'); return $build; @@ -82,15 +79,12 @@ function statistics_top_pages() { $rows[] = array($page->hits, _statistics_format_item($page->title, $page->path), t('%time ms', array('%time' => round($page->average_time))), format_interval(round($page->total_time / 1000))); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); - } - drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH); $build['statistics_top_pages_table'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $rows, + '#empty' => t('No statistics available.'), ); $build['statistics_top_pages_pager'] = array('#theme' => 'pager'); return $build; @@ -136,15 +130,12 @@ function statistics_top_visitors() { $rows[] = array($account->hits, ($account->uid ? theme('username', array('account' => $account)) : $account->hostname), format_interval(round($account->total / 1000)), (user_access('block IP addresses') && !$account->uid) ? $ban_link : ''); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); - } - drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH); $build['statistics_top_visitors_table'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $rows, + '#empty' => t('No statistics available.'), ); $build['statistics_top_visitors_pager'] = array('#theme' => 'pager'); return $build; @@ -186,14 +177,11 @@ function statistics_top_referrers() { $rows[] = array($referrer->hits, _statistics_link($referrer->url), t('@time ago', array('@time' => format_interval(REQUEST_TIME - $referrer->last)))); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3)); - } - $build['statistics_top_referrers_table'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $rows, + '#empty' => t('No statistics available.'), ); $build['statistics_top_referrers_pager'] = array('#theme' => 'pager'); return $build; diff --git a/modules/statistics/statistics.pages.inc b/modules/statistics/statistics.pages.inc index 048b8fa09..5dc6f8962 100644 --- a/modules/statistics/statistics.pages.inc +++ b/modules/statistics/statistics.pages.inc @@ -38,15 +38,12 @@ function statistics_node_tracker() { ); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 4)); - } - drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']); $build['statistics_table'] = array( '#theme' => 'table', '#header' => $header, - '#rows' => $rows + '#rows' => $rows, + '#empty' => t('No statistics available.'), ); $build['statistics_pager'] = array('#theme' => 'pager'); return $build; @@ -79,15 +76,12 @@ function statistics_user_tracker() { l(t('details'), "admin/reports/access/$log->aid")); } - if (empty($rows)) { - $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3)); - } - drupal_set_title(format_username($account)); $build['statistics_table'] = array( '#theme' => 'table', '#header' => $header, - '#rows' => $rows + '#rows' => $rows, + '#empty' => t('No statistics available.'), ); $build['statistics_pager'] = array('#theme' => 'pager'); return $build; diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index 0be0b2b69..06ad7f2d6 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -2493,12 +2493,7 @@ function theme_system_modules_uninstall($variables) { ); } - // Only display table if there are modules that can be uninstalled. - if (empty($rows)) { - $rows[] = array(array('data' => t('No modules are available to uninstall.'), 'colspan' => '3', 'align' => 'center', 'class' => array('message'))); - } - - $output = theme('table', array('header' => $header, 'rows' => $rows)); + $output = theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No modules are available to uninstall.'))); $output .= drupal_render_children($form); return $output; @@ -2648,14 +2643,11 @@ function system_date_time_formats() { } } - if (empty($rows)) { - $rows[] = array(array('data' => t('No custom date formats available. <a href="@link">Add date format</a>.', array('@link' => url('admin/config/regional/date-time/formats/add'))), 'colspan' => '5', 'class' => array('message'))); - } - $build['date_formats_table'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $rows, + '#empty' => ('No custom date formats available.'), ); return $build; @@ -3012,4 +3004,3 @@ function system_actions_remove_orphans() { actions_synchronize(TRUE); drupal_goto('admin/config/system/actions/manage'); } - diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index 03942a8e3..0ffead389 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -79,17 +79,13 @@ function theme_taxonomy_overview_vocabularies($variables) { } } - if (empty($rows)) { - $rows[] = array(array('data' => t('No vocabularies available. <a href="@link">Add vocabulary</a>.', array('@link' => url('admin/structure/taxonomy/add'))), 'colspan' => '5')); - } - $header = array(t('Vocabulary name')); if (isset($form['submit'])) { $header[] = t('Weight'); drupal_add_tabledrag('taxonomy', 'order', 'sibling', 'vocabulary-weight'); } $header[] = array('data' => t('Operations'), 'colspan' => '3'); - return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'taxonomy'))) . drupal_render_children($form); + return theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No vocabularies available.'),'attributes' => array('id' => 'taxonomy'))) . drupal_render_children($form); } /** @@ -704,7 +700,7 @@ function taxonomy_form_term($form, &$form_state, $edit = array(), $vocabulary = '#default_value' => $parent, '#multiple' => TRUE, ); - + } $form['advanced']['weight'] = array( '#type' => 'textfield', diff --git a/modules/tracker/tracker.pages.inc b/modules/tracker/tracker.pages.inc index f67597cd4..b3eb2bdcb 100644 --- a/modules/tracker/tracker.pages.inc +++ b/modules/tracker/tracker.pages.inc @@ -37,6 +37,7 @@ function tracker_page($account = NULL, $set_title = FALSE) { ->execute() ->fetchAllAssoc('nid'); + $rows = array(); if (!empty($nodes)) { // Now, get the data and put into the placeholder array $result = db_query('SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.nid IN (:nids)', array(':nids' => array_keys($nodes)), array('target' => 'slave')); @@ -46,7 +47,6 @@ function tracker_page($account = NULL, $set_title = FALSE) { } // Finally display the data - $rows = array(); foreach ($nodes as $node) { // Determine the number of comments: $comments = 0; @@ -68,14 +68,12 @@ function tracker_page($account = NULL, $set_title = FALSE) { ); } } - else { - $rows[] = array(array('data' => t('No content available.'), 'colspan' => '5')); - } $page['tracker'] = array( '#rows' => $rows, '#header' => array(t('Type'), t('Title'), t('Author'), t('Replies'), t('Last updated')), '#theme' => 'table', + '#empty' => t('No content available.'), '#attached' => array( 'css' => array(drupal_get_path('module', 'tracker') . '/tracker.css' => array('preprocess' => FALSE)), ), |