diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-04-26 16:30:28 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-04-26 16:30:28 +0000 |
commit | 2a7c00bc4ae154d51a01bc0f1f59ce7d70126181 (patch) | |
tree | 25fd30ccaa3740ecf305e10295216cd10c0fa94e | |
parent | f5d0e11f61c93d1ed4a6660408002b9ee1e8bd58 (diff) | |
download | brdo-2a7c00bc4ae154d51a01bc0f1f59ce7d70126181.tar.gz brdo-2a7c00bc4ae154d51a01bc0f1f59ce7d70126181.tar.bz2 |
- Patch #441962 by brianV: code style and documentation clean-up.
-rw-r--r-- | modules/block/block.admin.inc | 2 | ||||
-rw-r--r-- | modules/block/block.install | 5 | ||||
-rw-r--r-- | modules/block/block.module | 12 | ||||
-rw-r--r-- | modules/block/block.test | 9 |
4 files changed, 19 insertions, 9 deletions
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index b039c018f..5fcfbdbe8 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -272,7 +272,7 @@ function block_admin_configure(&$form_state, $module = NULL, $delta = 0) { function block_admin_configure_validate($form, &$form_state) { if ($form_state['values']['module'] == 'block') { - if (empty($form_state['values']['info']) || db_result(db_query("SELECT COUNT(*) FROM {box} WHERE bid != %d AND info = '%s'", $form_state['values']['delta'], $form_state['values']['info']))) { + if (empty($form_state['values']['info']) || db_result(db_query("SELECT COUNT(*) FROM {box} WHERE bid <> %d AND info = '%s'", $form_state['values']['delta'], $form_state['values']['info']))) { form_set_error('info', t('Please ensure that each block description is unique.')); } } diff --git a/modules/block/block.install b/modules/block/block.install index db8a2f503..a249c000e 100644 --- a/modules/block/block.install +++ b/modules/block/block.install @@ -2,6 +2,11 @@ // $Id$ /** + * @file + * Install instructions for the block module + */ + +/** * Implementation of hook_schema(). */ function block_schema() { diff --git a/modules/block/block.module b/modules/block/block.module index a933fbf30..ae79d143e 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -413,7 +413,7 @@ function block_box_save($edit, $delta) { function block_user_form(&$edit, &$account, $category = NULL) { if ($category == 'account') { $rids = array_keys($account->roles); - $result = db_query("SELECT DISTINCT b.* FROM {block} b LEFT JOIN {block_role} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom != 0 AND (r.rid IN (:rids) OR r.rid IS NULL) ORDER BY b.weight, b.module", array(':rids' => $rids)); + $result = db_query("SELECT DISTINCT b.* FROM {block} b LEFT JOIN {block_role} r ON b.module = r.module AND b.delta = r.delta WHERE b.status = 1 AND b.custom <> 0 AND (r.rid IN (:rids) OR r.rid IS NULL) ORDER BY b.weight, b.module", array(':rids' => $rids)); $form['block'] = array('#type' => 'fieldset', '#title' => t('Block configuration'), '#weight' => 3, '#collapsible' => TRUE, '#tree' => TRUE); while ($block = db_fetch_object($result)) { $data = module_invoke($block->module, 'block_list'); @@ -460,7 +460,7 @@ function block_form_system_performance_settings_alter(&$form, &$form_state) { '#disabled' => count(module_implements('node_grants')), '#description' => t('Note that block caching is inactive when modules defining content access restrictions are enabled.'), ); - + // Check if the "Who's online" block is enabled. $online_block_enabled = db_select('block') ->condition('module', 'user') @@ -469,13 +469,13 @@ function block_form_system_performance_settings_alter(&$form, &$form_state) { ->countQuery() ->execute() ->fetchField(); - + // If the "Who's online" block is enabled, append some descriptive text to // the end of the form description. if ($online_block_enabled) { $form['page_cache']['cache']['#description'] .= '<p>' . t('When caching is enabled, anonymous user sessions are only saved to the database when needed, so the "Who\'s online" block does not display the number of anonymous users.') . '</p>'; } - + } /** @@ -509,12 +509,12 @@ function block_system_themes_form_submit(&$form, &$form_state) { /** * Assign an initial, default set of blocks for a theme. - * + * * This function is called the first time a new theme is enabled. The new theme * gets a copy of the default theme's blocks, with the difference that if a * particular region isn't available in the new theme, the block is assigned * to the new theme's default region. - * + * * @param $theme * The name of a theme. */ diff --git a/modules/block/block.test b/modules/block/block.test index 00bc556a3..2c456739c 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -1,6 +1,11 @@ <?php // $Id$ +/** + * @file + * Tests for the block module + */ + class BlockTestCase extends DrupalWebTestCase { protected $regions; @@ -116,7 +121,7 @@ class BlockTestCase extends DrupalWebTestCase { // Confirm that the regions xpath is not availble $xpath = '//div[@id="block-block-' . $bid . '"]/*'; - $this->assertNoFieldByXPath($xpath, FALSE, t('Box found in no regions. ')); + $this->assertNoFieldByXPath($xpath, FALSE, t('Box found in no regions.')); // For convenience of developers, put the navigation block back. $edit = array(); @@ -140,7 +145,7 @@ class BlockTestCase extends DrupalWebTestCase { $this->drupalPost('admin/build/block', $edit, t('Save blocks')); // Confirm that the block was moved to the proper region. - $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name'=> $region['name']))); + $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region['name']))); // Confirm that the block is being displayed. $this->assertText(t($block['title']), t('Block successfully being displayed on the page.')); |