- Patch #8975 by drumm: remove block placement preview. Most themes, if not all the commonly used ones, can handle blocks on either side, and there is no way to see the preview without saving and seeing the results on the site.

Anything else that can be removed?  Less is more.
4.5.x
Dries Buytaert 2004-07-07 05:42:24 +00:00
parent 9d35fe7a7d
commit b05086c92f
2 changed files with 2 additions and 124 deletions

View File

@ -10,7 +10,7 @@ function block_help($section) {
return t("
<p>Blocks are the boxes visible in the sidebar(s) of your web site. These are usually generated automatically by modules (e.g. recent forum topics), but you can also create your own blocks using either static HTML or dynamic PHP content.</p>
<p>The sidebar each block appears in depends on both which theme you're using (some are left-only, some right, some both), and on the settings in block management.</p><p>Whether a block is visible in the first place depends on four things:</p><ul><li>It must have its \"enabled\" box checked in block management.</li><li>If it has its \"custom\" box checked in block management, the user must have chosen to display it in their user preferences.</li><li>If the \"path\" field in block management is set, the visitor must be on a page that matches the path specification (more on this later).</li><li>If the block has its throttle box checked, the user will only see the block if the site throttle level is low.</li></ul>
<p>The block management screen also lets you specify the vertical sort-order of the blocks within a sidebar. You do this by assigning a <strong>weight</strong> to each block. Lighter blocks (smaller weight) \"float up\" towards the top of the sidebar. Heavier ones \"sink down\" towards the bottom of it. Once you've positioned things just so, you can preview what the layout will look like in different types of themes by clicking the preview placement link in the menu to the left.</p>
<p>The block management screen also lets you specify the vertical sort-order of the blocks within a sidebar. You do this by assigning a <strong>weight</strong> to each block. Lighter blocks (smaller weight) \"float up\" towards the top of the sidebar. Heavier ones \"sink down\" towards the bottom of it.</p>
<p>The path setting lets you define the pages on which a specific block is visible. If you leave the path blank it will appear on all pages. The path uses a regular expression syntax so remember to escape special characters! The path expression is matched against the relative URL of a Drupal page, e.g. <code>book</code>, <code>node/12</code>, <code>admin</code>.</p>
<p>In case you do not know what a regular expression is, you should read about them in the PHP manual. The chapter to look at is the one on <a href=\"%pcre\">Perl-Compatible Regular Expressions (PCRE)</a>.</p>
<p>However, for basic tasks it is sufficient to look at the following examples:</p>
@ -42,8 +42,6 @@ function block_help($section) {
return t("Blocks are the boxes in the left- and right- side bars of the web site, depending on the chosen theme. They are created by <strong>active</strong> Drupal modules. The \"enabled\" checkbox sets the default status of the block. Only enabled blocks are shown. When the \"custom\" checkbox is checked, your users can show or hide the block using their account settings. In that case, the 'enabled' checkbox signifies the block's default status. You can assign the block's placement by giving it a region and a weight. The region specifies which side of the page the block is on, and the weight sorts blocks within a region. Lighter (smaller weight value) blocks \"float up\" towards the top of the page. The path setting lets you define which pages you want a block to be shown on. You can also create your own blocks, where you specify the content of the block rather than its being generated by a module (you can even use PHP in these). You can create one of these by clicking the <a href=\"%createblock\">add block</a> tab in the menu to the left. Edit and delete links will become active below for these admin-defined blocks. Blocks can automatically be temporarily disabled to reduce server load when your site becomes extremely busy by checking throttle. The auto-throttle functionality must be enabled on the <a href=\"%throttle\">throttle configuration page</a> after having enabled the throttle module.", array('%createblock' => url('admin/block/add'), '%throttle' => url('admin/settings/throttle')));
case 'admin/block/add':
return t("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. If you are going to place PHP code in the block, and you have the <em>create php content</em> permission (see the <a href=\"%permission\">permissions</a> page), you <em>must</em> change the type to PHP to make your code active.", array('%overview' => url('admin/block'), '%permission' => url('admin/user/configure/permission')));
case 'admin/block/preview':
return t('This page shows you the placement of your blocks in different theme types. The numbers are the weights of each block, which are used to sort them within the sidebars.');
}
}
@ -82,10 +80,6 @@ function block_menu() {
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/block/preview', 'title' => t('preview'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin_preview',
'type' => MENU_LOCAL_TASK);
return $items;
}
@ -205,61 +199,6 @@ function block_admin_display() {
return form($output, 'post', url('admin/block'));
}
/**
* Menu callback; displays the block layout as it will appear when themed.
*/
function block_admin_preview() {
$result = db_query('SELECT * FROM {blocks} WHERE status > 0 AND region = 0 ORDER BY weight');
$lblocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
while ($block = db_fetch_object($result)) {
$block_data = module_invoke($block->module, 'block', 'list');
$name = $block_data[$block->delta]['info'];
$lblocks .= ' <tr><td>'. ($block->status == 2 ? "<strong>$name</strong>" : $name) ."</td><td>$block->weight</td></tr>\n";
}
$lblocks .= "</table>\n";
$result = db_query('SELECT * FROM {blocks} WHERE status > 0 AND region = 1 ORDER BY weight');
$rblocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
while ($block = db_fetch_object($result)) {
$block_data = module_invoke($block->module, 'block', 'list');
$name = $block_data[$block->delta]['info'];
$rblocks .= ' <tr><td>'. ($block->status == 2 ? "<strong>$name</strong>" : $name) ."</td><td>$block->weight</td></tr>\n";
}
$rblocks .= "</table>\n";
$output .= '<h3>'. t('Themes with both left and right sidebars') .":</h3>\n";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= ' <tr><td colspan="3" style="text-align: center;">'. t('header') ."</td></tr>\n";
$output .= " <tr><td>\n". ($lblocks ? $lblocks : '&nbsp;') ."</td><td style=\"width: 300px;\">&nbsp;</td><td>\n". ($rblocks ? $rblocks : '&nbsp;') ."</td></tr>\n";
$output .= ' <tr><td colspan="3" style="text-align: center;">'. t('footer') ."</td></tr>\n";
$output .= "</table>\n";
$result = db_query('SELECT * FROM {blocks} WHERE status > 0 ORDER BY weight');
$blocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
while ($block = db_fetch_object($result)) {
$block_data = module_invoke($block->module, 'block', 'list');
$name = $block_data[$block->delta]['info'];
$blocks .= ' <tr><td>'. ($block->status == 2 ? "<strong>$name</strong>" : $name) ."</td><td>$block->weight</td></tr>\n";
}
$blocks .= "</table>\n";
$output .= '<h3>'. t('Themes with right sidebar only') .":</h3>\n";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= ' <tr><td colspan="2" style="text-align: center;">'. t('header') ."</td></tr>\n";
$output .= " <tr><td style=\"width: 400px;\">&nbsp;</td><td>\n". ($blocks ? $blocks : '&nbsp;') ."</td></tr>\n";
$output .= ' <tr><td colspan="2" style="text-align: center;">'. t('footer') ."</td></tr>\n";
$output .= "</table>\n";
$output .= '<h3>'. t('Themes with left sidebar only') .":</h3>\n";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= ' <tr><td colspan="2" style="text-align: center;">'. t('header') ."</td></tr>\n";
$output .= " <tr><td>\n". ($blocks ? $blocks : '&nbsp;') ."</td><td style=\"width: 400px;\">&nbsp;</td></tr>\n";
$output .= ' <tr><td colspan="2" style="text-align: center;">'. t('footer') ."</td></tr>\n";
$output .= "</table>\n";
print theme('page', $output);
}
function block_box_get($bid) {
return db_fetch_array(db_query('SELECT * FROM {boxes} WHERE bid = %d', $bid));
}

View File

@ -10,7 +10,7 @@ function block_help($section) {
return t("
<p>Blocks are the boxes visible in the sidebar(s) of your web site. These are usually generated automatically by modules (e.g. recent forum topics), but you can also create your own blocks using either static HTML or dynamic PHP content.</p>
<p>The sidebar each block appears in depends on both which theme you're using (some are left-only, some right, some both), and on the settings in block management.</p><p>Whether a block is visible in the first place depends on four things:</p><ul><li>It must have its \"enabled\" box checked in block management.</li><li>If it has its \"custom\" box checked in block management, the user must have chosen to display it in their user preferences.</li><li>If the \"path\" field in block management is set, the visitor must be on a page that matches the path specification (more on this later).</li><li>If the block has its throttle box checked, the user will only see the block if the site throttle level is low.</li></ul>
<p>The block management screen also lets you specify the vertical sort-order of the blocks within a sidebar. You do this by assigning a <strong>weight</strong> to each block. Lighter blocks (smaller weight) \"float up\" towards the top of the sidebar. Heavier ones \"sink down\" towards the bottom of it. Once you've positioned things just so, you can preview what the layout will look like in different types of themes by clicking the preview placement link in the menu to the left.</p>
<p>The block management screen also lets you specify the vertical sort-order of the blocks within a sidebar. You do this by assigning a <strong>weight</strong> to each block. Lighter blocks (smaller weight) \"float up\" towards the top of the sidebar. Heavier ones \"sink down\" towards the bottom of it.</p>
<p>The path setting lets you define the pages on which a specific block is visible. If you leave the path blank it will appear on all pages. The path uses a regular expression syntax so remember to escape special characters! The path expression is matched against the relative URL of a Drupal page, e.g. <code>book</code>, <code>node/12</code>, <code>admin</code>.</p>
<p>In case you do not know what a regular expression is, you should read about them in the PHP manual. The chapter to look at is the one on <a href=\"%pcre\">Perl-Compatible Regular Expressions (PCRE)</a>.</p>
<p>However, for basic tasks it is sufficient to look at the following examples:</p>
@ -42,8 +42,6 @@ function block_help($section) {
return t("Blocks are the boxes in the left- and right- side bars of the web site, depending on the chosen theme. They are created by <strong>active</strong> Drupal modules. The \"enabled\" checkbox sets the default status of the block. Only enabled blocks are shown. When the \"custom\" checkbox is checked, your users can show or hide the block using their account settings. In that case, the 'enabled' checkbox signifies the block's default status. You can assign the block's placement by giving it a region and a weight. The region specifies which side of the page the block is on, and the weight sorts blocks within a region. Lighter (smaller weight value) blocks \"float up\" towards the top of the page. The path setting lets you define which pages you want a block to be shown on. You can also create your own blocks, where you specify the content of the block rather than its being generated by a module (you can even use PHP in these). You can create one of these by clicking the <a href=\"%createblock\">add block</a> tab in the menu to the left. Edit and delete links will become active below for these admin-defined blocks. Blocks can automatically be temporarily disabled to reduce server load when your site becomes extremely busy by checking throttle. The auto-throttle functionality must be enabled on the <a href=\"%throttle\">throttle configuration page</a> after having enabled the throttle module.", array('%createblock' => url('admin/block/add'), '%throttle' => url('admin/settings/throttle')));
case 'admin/block/add':
return t("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. If you are going to place PHP code in the block, and you have the <em>create php content</em> permission (see the <a href=\"%permission\">permissions</a> page), you <em>must</em> change the type to PHP to make your code active.", array('%overview' => url('admin/block'), '%permission' => url('admin/user/configure/permission')));
case 'admin/block/preview':
return t('This page shows you the placement of your blocks in different theme types. The numbers are the weights of each block, which are used to sort them within the sidebars.');
}
}
@ -82,10 +80,6 @@ function block_menu() {
'access' => user_access('administer blocks'),
'callback' => 'block_box_edit',
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/block/preview', 'title' => t('preview'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin_preview',
'type' => MENU_LOCAL_TASK);
return $items;
}
@ -205,61 +199,6 @@ function block_admin_display() {
return form($output, 'post', url('admin/block'));
}
/**
* Menu callback; displays the block layout as it will appear when themed.
*/
function block_admin_preview() {
$result = db_query('SELECT * FROM {blocks} WHERE status > 0 AND region = 0 ORDER BY weight');
$lblocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
while ($block = db_fetch_object($result)) {
$block_data = module_invoke($block->module, 'block', 'list');
$name = $block_data[$block->delta]['info'];
$lblocks .= ' <tr><td>'. ($block->status == 2 ? "<strong>$name</strong>" : $name) ."</td><td>$block->weight</td></tr>\n";
}
$lblocks .= "</table>\n";
$result = db_query('SELECT * FROM {blocks} WHERE status > 0 AND region = 1 ORDER BY weight');
$rblocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
while ($block = db_fetch_object($result)) {
$block_data = module_invoke($block->module, 'block', 'list');
$name = $block_data[$block->delta]['info'];
$rblocks .= ' <tr><td>'. ($block->status == 2 ? "<strong>$name</strong>" : $name) ."</td><td>$block->weight</td></tr>\n";
}
$rblocks .= "</table>\n";
$output .= '<h3>'. t('Themes with both left and right sidebars') .":</h3>\n";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= ' <tr><td colspan="3" style="text-align: center;">'. t('header') ."</td></tr>\n";
$output .= " <tr><td>\n". ($lblocks ? $lblocks : '&nbsp;') ."</td><td style=\"width: 300px;\">&nbsp;</td><td>\n". ($rblocks ? $rblocks : '&nbsp;') ."</td></tr>\n";
$output .= ' <tr><td colspan="3" style="text-align: center;">'. t('footer') ."</td></tr>\n";
$output .= "</table>\n";
$result = db_query('SELECT * FROM {blocks} WHERE status > 0 ORDER BY weight');
$blocks .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";
while ($block = db_fetch_object($result)) {
$block_data = module_invoke($block->module, 'block', 'list');
$name = $block_data[$block->delta]['info'];
$blocks .= ' <tr><td>'. ($block->status == 2 ? "<strong>$name</strong>" : $name) ."</td><td>$block->weight</td></tr>\n";
}
$blocks .= "</table>\n";
$output .= '<h3>'. t('Themes with right sidebar only') .":</h3>\n";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= ' <tr><td colspan="2" style="text-align: center;">'. t('header') ."</td></tr>\n";
$output .= " <tr><td style=\"width: 400px;\">&nbsp;</td><td>\n". ($blocks ? $blocks : '&nbsp;') ."</td></tr>\n";
$output .= ' <tr><td colspan="2" style="text-align: center;">'. t('footer') ."</td></tr>\n";
$output .= "</table>\n";
$output .= '<h3>'. t('Themes with left sidebar only') .":</h3>\n";
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
$output .= ' <tr><td colspan="2" style="text-align: center;">'. t('header') ."</td></tr>\n";
$output .= " <tr><td>\n". ($blocks ? $blocks : '&nbsp;') ."</td><td style=\"width: 400px;\">&nbsp;</td></tr>\n";
$output .= ' <tr><td colspan="2" style="text-align: center;">'. t('footer') ."</td></tr>\n";
$output .= "</table>\n";
print theme('page', $output);
}
function block_box_get($bid) {
return db_fetch_array(db_query('SELECT * FROM {boxes} WHERE bid = %d', $bid));
}