/[drupal]/drupal/modules/block.module
ViewVC logotype

Diff of /drupal/modules/block.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.162, Mon Apr 4 12:27:05 2005 UTC revision 1.162.2.6, Tue Aug 22 19:32:56 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: block.module,v 1.161 2005/03/31 09:25:33 unconed Exp $  // $Id: block.module,v 1.162.2.5 2005/07/20 11:41:57 dries Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 20  function block_help($section) { Line 20  function block_help($section) {
20  <ul>  <ul>
21  <li>Its enabled checkbox. Disabled blocks are never shown.</li>  <li>Its enabled checkbox. Disabled blocks are never shown.</li>
22  <li>Its throttle checkbox. Throttled blocks are hidden during high server loads.</li>  <li>Its throttle checkbox. Throttled blocks are hidden during high server loads.</li>
23  <li>Its path options. Blocks can be configured to only show/hide on certain pages</li>.  <li>Its path options. Blocks can be configured to only show/hide on certain pages.</li>
24  <li>User settings. You can choose to let your users decide whether to show/hide certain blocks.</li>  <li>User settings. You can choose to let your users decide whether to show/hide certain blocks.</li>
25  <li>Its function. Dynamic blocks (such as those defined by modules) may be empty on certain pages and will not be shown.</li>  <li>Its function. Dynamic blocks (such as those defined by modules) may be empty on certain pages and will not be shown.</li>
26  </ul>  </ul>
# Line 33  function block_help($section) { Line 33  function block_help($section) {
33        return t("        return t("
34  <p>Blocks are the boxes in the left and right side bars of the web site. They are made available by modules or created manually.</p>  <p>Blocks are the boxes in the left and right side bars of the web site. They are made available by modules or created manually.</p>
35  <p>Only enabled blocks are shown. You can position the blocks by deciding which side of the page they will show up on (sidebar) and in which order they appear (weight).</p>  <p>Only enabled blocks are shown. You can position the blocks by deciding which side of the page they will show up on (sidebar) and in which order they appear (weight).</p>
36  <p>If you want certain blocks to disable themselves temporarily during high server loads, check the 'Throttle' box. You can configure the auto-throttle on the <a href=\"%throttle\">throttle configuration page</a> after having enabled the throttle module.  <p>If you want certain blocks to disable themselves temporarily during high server loads, check the 'Throttle' box. You can configure the auto-throttle on the <a href=\"%throttle\">throttle configuration page</a> after having enabled the throttle module.</p>
37  ", array('%throttle' => url('admin/settings/throttle')));  ", array('%throttle' => url('admin/settings/throttle')));
38      case 'admin/block/add':      case 'admin/block/add':
39        return t('<p>Here you can create a new block. Once you have created this block you must make it active and give it a place on the page using <a href="%overview">blocks</a>. The title is used when displaying the block. The description is used in the "block" column on the <a href="%overview">blocks</a> page.</p>', array('%overview' => url('admin/block')));        return t('<p>Here you can create a new block. Once you have created this block you must make it active and give it a place on the page using <a href="%overview">blocks</a>. The title is used when displaying the block. The description is used in the "block" column on the <a href="%overview">blocks</a> page.</p>', array('%overview' => url('admin/block')));
# Line 264  function block_admin_configure($module = Line 264  function block_admin_configure($module =
264        }        }
265        db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d, types = '%s' WHERE module = '%s' AND delta = '%s'", $edit['visibility'], $edit['pages'], $edit['custom'], $types, $module, $delta);        db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d, types = '%s' WHERE module = '%s' AND delta = '%s'", $edit['visibility'], $edit['pages'], $edit['custom'], $types, $module, $delta);
266        module_invoke($module, 'block', 'save', $delta, $edit);        module_invoke($module, 'block', 'save', $delta, $edit);
267        drupal_set_message('The block configuration has been saved.');        drupal_set_message(t('The block configuration has been saved.'));
268        cache_clear_all();        cache_clear_all();
269        drupal_goto('admin/block');        drupal_goto('admin/block');
270    
# Line 351  function block_box_delete($bid = 0) { Line 351  function block_box_delete($bid = 0) {
351  }  }
352    
353  function block_box_form($edit = array()) {  function block_box_form($edit = array()) {
354    $output = form_textfield(t('Block title'), 'title', $edit['title'], 50, 64, t('The title of the block as shown to the user.'));    $output = form_textfield(t('Block title'), 'title', $edit['title'], 50, 64, t('The title of the block as shown to the user. Leave blank for no title.'));
355    $output .= filter_form('format', $edit['format']);    $output .= filter_form('format', $edit['format']);
356    $output .= form_textarea(t('Block body'), 'body', $edit['body'], 70, 10, t('The content of the block as shown to the user.'));    $output .= form_textarea(t('Block body'), 'body', $edit['body'], 70, 10, t('The content of the block as shown to the user.'));
357    $output .= form_textfield(t('Block description'), 'info', $edit['info'], 50, 64, t('A brief description of your block. Used on the <a href="%overview">block overview page</a>.', array('%overview' => url('admin/block'))));    $output .= form_textfield(t('Block description'), 'info', $edit['info'], 50, 64, t('A brief description of your block. Used on the <a href="%overview">block overview page</a>.', array('%overview' => url('admin/block'))));
# Line 452  function block_list($region, $regions = Line 452  function block_list($region, $regions =
452    
453    if (!isset($blocks[$region])) {    if (!isset($blocks[$region])) {
454      $blocks[$region] = array();      $blocks[$region] = array();
455      $result = db_query("SELECT * FROM {blocks} WHERE status = 1 AND region IN ('%s') ORDER BY weight, module", $regions[$region]);      $result = db_query("SELECT * FROM {blocks} WHERE status = 1 AND region IN (%s) ORDER BY weight, module", $regions[$region]);
456      while ($block = db_fetch_array($result)) {      while ($block = db_fetch_array($result)) {
457        // Use the user's block visibility setting, if necessary        // Use the user's block visibility setting, if necessary
458        if ($block['custom'] != 0) {        if ($block['custom'] != 0) {
# Line 470  function block_list($region, $regions = Line 470  function block_list($region, $regions =
470        // Match path if necessary        // Match path if necessary
471        if ($block['pages']) {        if ($block['pages']) {
472          $path = drupal_get_path_alias($_GET['q']);          $path = drupal_get_path_alias($_GET['q']);
473          $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. variable_get('site_frontpage', 'node') .'\2'), preg_quote($block['pages'], '/')) .')$/';          $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($block['pages'], '/')) .')$/';
474          $page_match = !($block['visibility'] xor preg_match($regexp, $path));          $page_match = !($block['visibility'] xor preg_match($regexp, $path));
475        }        }
476        else {        else {

Legend:
Removed from v.1.162  
changed lines
  Added in v.1.162.2.6

  ViewVC Help
Powered by ViewVC 1.1.2