? .cache ? .project ? .settings ? _forum_new_obsolete.patch ? blockcache_fieldset.patch ? registry-split.patch ? taxonomy_term_delete.patch ? sites/sqlite.drupal7 ? sites/sub.drupal7 ? sites/all/modules ? sites/all/themes ? sites/default/files ? sites/default/settings.php Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.31 diff -u -p -r1.31 block.admin.inc --- modules/block/block.admin.inc 22 Nov 2008 11:14:48 -0000 1.31 +++ modules/block/block.admin.inc 15 Dec 2008 18:26:05 -0000 @@ -154,7 +154,7 @@ function block_admin_configure(&$form_st '#value' => $delta, ); - $edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {block} WHERE module = '%s' AND delta = '%s'", $module, $delta)); + $edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title, cache FROM {block} WHERE module = '%s' AND delta = '%s'", $module, $delta)); $form['block_settings'] = array( '#type' => 'fieldset', @@ -262,7 +262,35 @@ function block_admin_configure(&$form_st '#default_value' => $edit['custom'], ); + // Blockcache options. + $options = array( + BLOCK_NO_CACHE => t('Do not cache'), + BLOCK_CACHE_GLOBAL => t('Cache once for everything (global)'), + BLOCK_CACHE_PER_PAGE => t('Per page'), + BLOCK_CACHE_PER_ROLE => t('Per role'), + BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE => t('Per role per page'), + BLOCK_CACHE_PER_USER => t('Per user'), + BLOCK_CACHE_PER_USER | BLOCK_CACHE_PER_PAGE => t('Per user per page'), + ); + + // Create cache settings fieldset. + $form['cache_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Cache settings'), + '#weight' => 1, + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form['cache_settings']['cache'] = array( + '#type' => 'select', + '#title' => t('Cache setting'), + '#description' => t('Select the appropriate cache setting for this block.'), + '#options' => $options, + '#default_value' => $edit['cache'], + ); + $form['submit'] = array( + '#weight' => 10, '#type' => 'submit', '#value' => t('Save block'), ); @@ -280,7 +308,7 @@ function block_admin_configure_validate( function block_admin_configure_submit($form, &$form_state) { if (!form_get_errors()) { - db_query("UPDATE {block} SET visibility = %d, pages = '%s', custom = %d, title = '%s' WHERE module = '%s' AND delta = '%s'", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['module'], $form_state['values']['delta']); + db_query("UPDATE {block} SET visibility = %d, pages = '%s', custom = %d, title = '%s', cache = %d WHERE module = '%s' AND delta = '%s'", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['cache'], $form_state['values']['module'], $form_state['values']['delta']); db_query("DELETE FROM {block_role} WHERE module = '%s' AND delta = '%s'", $form_state['values']['module'], $form_state['values']['delta']); foreach (array_filter($form_state['values']['roles']) as $rid) { db_query("INSERT INTO {block_role} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_state['values']['module'], $form_state['values']['delta']);