? 514256-block-D7-10.patch ? fix.image.media.patch ? showonallpages.patch ? sites/default/files ? sites/default/private ? sites/default/settings.php Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.48 diff -u -p -r1.48 block.admin.inc --- modules/block/block.admin.inc 12 Aug 2009 11:43:09 -0000 1.48 +++ modules/block/block.admin.inc 22 Aug 2009 11:06:46 -0000 @@ -221,39 +221,38 @@ function block_admin_configure(&$form_st drupal_set_title(t("'%name' block", array('%name' => $info[$delta]['info'])), PASS_THROUGH); } + // Add JavaScript to hide the pages fieldset of the show always option is set. + drupal_add_js(drupal_get_path('module', 'block') . '/block.js'); + drupal_add_js(array('block' => array('visibilityPageAlways' => BLOCK_VISIBILITY_PAGE_ALWAYS)), 'setting'); + $form['page_vis_settings'] = array( '#type' => 'fieldset', '#title' => t('Page specific visibility settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); + if (!$edit['visibility']) ($edit['visibility'] = BLOCK_VISIBILITY_PAGE_ALWAYS); + $form['page_vis_settings']['visibility'] = array( + '#type' => 'radios', + '#title' => t('Show this block'), + '#options' => array( + BLOCK_VISIBILITY_PAGE_ALWAYS => t('On every page.'), + BLOCK_VISIBILITY_PAGE_EXCLUDE => t('On every page except those specified.'), + BLOCK_VISIBILITY_PAGE_INCLUDE => t('On only the pages specified.'), + ), + '#default_value' => $edit['visibility'], + '#access' => user_access('use PHP for settings') || $edit['visibility'] != BLOCK_VISIBILITY_PAGE_PHP, + ); + $form['page_vis_settings']['pages'] = array( + '#type' => 'textarea', + '#title' => t('Pages'), + '#default_value' => $edit['pages'], + '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '')), + ); - $access = user_access('use PHP for settings'); - if ($edit['visibility'] == 2 && !$access) { - $form['page_vis_settings'] = array(); - $form['page_vis_settings']['visibility'] = array('#type' => 'value', '#value' => 2); - $form['page_vis_settings']['pages'] = array('#type' => 'value', '#value' => $edit['pages']); - } - else { - $options = array(t('Every page except those specified below.'), t('Only the pages specified below.')); - $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '')); - - if (module_exists('php') && $access) { - $options[] = t('Show if the following PHP code returns TRUE (PHP-mode, experts only).'); - $description .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '')); - } - $form['page_vis_settings']['visibility'] = array( - '#type' => 'radios', - '#title' => t('Show block on specific pages'), - '#options' => $options, - '#default_value' => $edit['visibility'], - ); - $form['page_vis_settings']['pages'] = array( - '#type' => 'textarea', - '#title' => t('Pages'), - '#default_value' => $edit['pages'], - '#description' => $description, - ); + if (module_exists('php') && user_access('use PHP for settings')) { + $form['page_vis_settings']['visibility']['#options'][BLOCK_VISIBILITY_PAGE_PHP] = t('If the following PHP code returns TRUE (PHP-mode, experts only).'); + $form['page_vis_settings']['pages']['#description'] .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '')); } // Role-based visibility settings. @@ -416,12 +415,12 @@ function block_add_block_form_submit($fo 'visibility' => (int) $form_state['values']['visibility'], 'pages' => trim($form_state['values']['pages']), 'custom' => (int) $form_state['values']['custom'], - 'title' => $form_state['values']['title'], + 'title' => $form_state['values']['title'], 'module' => $form_state['values']['module'], - 'theme' => $theme->name, + 'theme' => $theme->name, 'status' => 0, 'weight' => 0, - 'delta' => $delta, + 'delta' => $delta, 'cache' => BLOCK_NO_CACHE, )); } Index: modules/block/block.js =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.js,v retrieving revision 1.10 diff -u -p -r1.10 block.js --- modules/block/block.js 4 Aug 2009 06:26:52 -0000 1.10 +++ modules/block/block.js 22 Aug 2009 10:19:22 -0000 @@ -10,6 +10,9 @@ Drupal.behaviors.blockDrag = { attach: function (context, settings) { var table = $('table#blocks'); + if (!$('table#blocks').size()) { + return; + } var tableDrag = Drupal.tableDrag.blocks; // Get the blocks tableDrag object. // Add a handler for when a row is swapped, update empty regions. @@ -107,4 +110,20 @@ Drupal.behaviors.blockDrag = { } }; +/** + * Show all of the picture-related form elements at admin/settings/user + * depending on whether user pictures are enabled or not. + */ +Drupal.behaviors.blockVisibilitySettings = { + attach: function (context, settings) { + $("input[name='visibility']:not(.block-processed)", context).each(function () { + $(this).change(function (event) { + $('div.pages-wrapper', context).toggle($(this).val() != Drupal.settings.block.visibilityPageAlways); + }); + $(this).addClass('block-processed'); + }); + $('div.pages-wrapper', context).toggle($("input[name='visibility'][checked]").val() != Drupal.settings.block.visibilityPageAlways); + } +}; + })(jQuery); Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.360 diff -u -p -r1.360 block.module --- modules/block/block.module 20 Aug 2009 10:56:33 -0000 1.360 +++ modules/block/block.module 22 Aug 2009 10:19:22 -0000 @@ -60,6 +60,11 @@ define('BLOCK_CACHE_PER_PAGE', 0x0004); */ define('BLOCK_CACHE_GLOBAL', 0x0008); +define('BLOCK_VISIBILITY_PAGE_ALWAYS', 3); +define('BLOCK_VISIBILITY_PAGE_PHP', 2); +define('BLOCK_VISIBILITY_PAGE_EXCLUDE', 0); +define('BLOCK_VISIBILITY_PAGE_INCLUDE', 1); + /** * Implement hook_help(). */