summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-12-02 14:56:32 +0000
committerDries Buytaert <dries@buytaert.net>2009-12-02 14:56:32 +0000
commit92760988b9decb01831ba89bcc54056a702c3836 (patch)
tree4a27865ed1737d832e82a575521940503147cd43 /modules
parente7dedc4330f3d7bbc4fd861a4e5619d780bcca6c (diff)
downloadbrdo-92760988b9decb01831ba89bcc54056a702c3836.tar.gz
brdo-92760988b9decb01831ba89bcc54056a702c3836.tar.bz2
- Patch #648410 by Dave Reid: standardize add 'empty' row functionality to all tables.
Diffstat (limited to 'modules')
-rw-r--r--modules/aggregator/aggregator.admin.inc10
-rw-r--r--modules/book/book.admin.inc8
-rw-r--r--modules/dblog/dblog.admin.inc10
-rw-r--r--modules/locale/locale.test24
-rw-r--r--modules/node/content_types.inc9
-rw-r--r--modules/node/node.admin.inc9
-rw-r--r--modules/path/path.admin.inc8
-rw-r--r--modules/profile/profile.admin.inc5
-rw-r--r--modules/statistics/statistics.admin.inc20
-rw-r--r--modules/statistics/statistics.pages.inc14
-rw-r--r--modules/system/system.admin.inc13
-rw-r--r--modules/taxonomy/taxonomy.admin.inc8
-rw-r--r--modules/tracker/tracker.pages.inc6
13 files changed, 37 insertions, 107 deletions
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)),
),