Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 28 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
28
Dung lượng
798,13 KB
Nội dung
Chapter 4 [ 97 ] The dashboard is made up of two unequally sized regions. Each region can contain one or more blocks. Each region is outlined with dashed lines while you are customizing the dashboard. A list of all blocks that can be added to the dashboard are displayed above the regions. Drupal 7 Administration [ 98 ] To add a block to a region, drag it from the list of blocks to the region you want to insert it into. A gray bar will appear in the region showing where the block will be inserted. You can insert blocks above or below any existing blocks. To remove a block, simply reverse the process by grabbing a block by its gray title bar and dragging it back to the list of blocks. If you don't nd a block that meets your needs in the existing list of blocks, you can create a custom block. For example, you could create a short menu of commonly-used links, or you could add blocks to return various statistics about your site. Let's build a quick block to display the current database size. Start by clicking on the Add block link. You will be taken to the block creation page where you can enter information about the block. Chapter 4 [ 99 ] As you can see, we need to enter the title and description of the block as well as the body that controls the output of the block. In this case, we set the Text format to PHP code so we can query the database. Here is the complete text of the block body. This code is based on a code snippet from the Drupal site, but it has been adjusted for Drupal 7. You can nd the original Drupal 6 code at http://drupal.org/node/100270: <?php function db_size_info($dbsize) { //Load the units of measure into an array $bytes = array('KB', 'KB', 'MB', 'GB', 'TB'); //Reduce the size of the database to the correct scale by //dividing by 1024 until we reach a value between 1 and 1024 if ($dbsize < 1024) $dbsize = 1; for ($i = 0; $dbsize > 1024; $i++) $dbsize /= 1024; //Now that the size has been reduced properly, setup the //return value and units. $db_size_info['size'] = ceil($dbsize); Drupal 7 Administration [ 100 ] $db_size_info['type'] = $bytes[$i]; return $db_size_info; } //Load statistics from the database $rows = db_query("SHOW TABLE STATUS")->fetchAll(); //Loop through each row of data to calculate the total size $dbssize = 0; foreach ($rows as $row) { $dbssize += $row->data_length + $row->index_length; } //Print the raw number of bytes in the database print "$dbssize bytes "; //Calculate and print the normalized size of the database $dbssize = db_size_info($dbssize); print "({$dbssize['size']} {$dbssize['type']})"; ?> After you have entered the appropriate information into the block, click on the Save block button. The block will be created and added to the list of available blocks. To add it to your dashboard, simply drag it into one of the available regions. The resulting dashboard will appear similar to the following: After you have nished modifying your database, click on the Done button to return to the regular view. Chapter 4 [ 101 ] Overlay window As you may have noticed in the previous screenshots, the administration pages no longer appear in their own page. Instead, they open in an overlay window, which appears on top of your normal site content as shown below: This allows you to easily return to your content after you have completed your administrative changes. You can close the overlay window by clicking on the X at the top right-hand side corner of the overlay panel. Drupal 7 Administration [ 102 ] Appearance section The Appearance section gives you control over the themes installed on your site. When you rst click on the Appearance link, you are taken to a list of themes that have been installed on the site, as shown in the following screenshot: Download f r o m W o w ! e B o o k < w w w.woweb o o k . c o m > Chapter 4 [ 103 ] From this page, you can enable or disable themes and set the active theme, which is used when displaying content. The Administration theme drop down allows you to change the theme used when administering the site. This functionality is unchanged from Drupal 6. In Drupal 6, you could reach this functionality by selecting Administer | Site building | Themes. Clicking on the Settings link for an enabled theme allows you to change the display of various elements within the site, set logos and shortcut icons, and so on. The exact settings that are available depend on the theme being congured. This functionality matches the Drupal 6 functionality. Installing and updating themes and modules As you may have noticed on the list of available themes, there are links at the top of the page to Update existing themes and Install new theme. These are new features within Drupal 7, and they denitely make life easier for administrators. Let's start by looking into installing new themes and then we will review updating themes. Installing new themes and modules To start the installation process for a theme, click on the Install new theme link. This will display a form, as shown below, where you can install a theme or module: There are two different ways you can install a theme. You can either install the theme directly from the Drupal.org site to your local machine or you can upload a module that has either been downloaded from the Drupal.org site or built locally. Drupal 7 Administration [ 104 ] To install a theme from the Drupal.org site, you will rst need to visit Drupal.org and nd a theme that you want to use. After you have found a theme, visit its project page. Scroll down to the releases section and right click on the Download link: From the pop-up menu, select Copy Link Location if you are using Firefox or Copy Shortcut if you are using Internet Explorer. Other browsers will have similar options. This will copy the download path for the theme to your clipboard. Now switch back to your site and paste the link into the Install from a URL text box. After you have set the URL for the theme you want to install, click on the Install button. Drupal will automatically download the theme and install it onto your site. During this process, the status of the installation will be shown. After the installation is complete, you will receive a status page similar to the following: Chapter 4 [ 105 ] From this status page, you can set the new theme as your default theme or you can return to either the administration interface or your front page. Installing from a downloaded package is similar to installing directly from a URL, with a few exceptions. After nding a theme that you like, download it to your local computer instead of simply copying the download link. You can then browse for the location of the module on your local computer. You will need to click on Install to start the installation process. This functionality can also be used to install modules. The process is exactly the same as installing a theme and the status page is also similar. Drupal 7 Administration [ 106 ] Updating themes and modules When you click on the Update existing modules link, Drupal will display a list of any modules that have updates available: If any modules or themes have updates, you can install them from this page. You can also check for updates manually if the system has not automatically checked for updates recently. People section The People section allows you to view and manage the users within your site, and appears as follows: [...]... your site For purposes of review, I have enabled all of the Drupal modules that are available in Drupal core [ 108 ] Chapter 4 Configuring settings The majority of the settings are the same from Drupal 6 to Drupal 7 Let's look at each set of settings in Drupal 7 For each group of settings, we will identify the new Drupal 7 path and the old Drupal 6 path and menu descriptions We will also provide a brief... • Drupal 7 path: admin/config/regional/system/shortcut • Drupal 6 menu location: N/A • Drupal 6 path: N/A [ 1 15 ] Drupal 7 Administration • Description: Allows you to build shortcuts for display in the new shortcuts bar • New settings: This is new Drupal 7 functionality We will review this functionality in depth a little later in this chapter Statistics The details are as follows: • Drupal 7 path: admin/config/system/statistics... download method you wish to use [ 113 ] Drupal 7 Administration Image styles The details are as follows: • Drupal 7 path: admin/config/media/image-styles • Drupal 6 menu location: N/A • Drupal 6 path: N/A • Description: Allows you to configure automatic resizing and processing of images that have been added to the site This is all new functionality in Drupal 7, which we covered in detail in the last... later in the chapter [ 109 ] Drupal 7 Administration Language The details are as follows: • Drupal 7 path: admin/config/regional/language • Drupal 6 menu location: Administer | Site configuration | Languages • Drupal 6 path: admin/settings/language • Description: It allows configuration of which labels are available to site users for display on the site • New settings: Drupal 7 allows additional control... functionality is the same as Drupal 6 IP address blocking The details are as follows: • Drupal 7 path: admin/config/people/ip-blocking • Drupal 6 menu location: Administer | User management | Access rules • Drupal 6 path: admin/user/rules • Description: This page allows you to block certain computers based on IP address [ 1 17 ] Download from Wow! eBook Drupal 7 Administration • New settings:... details are as follows: • Drupal 7 path: admin/config/regional/settings • Drupal 6 menu location: Administer | Site configuration | Date and Time • Drupal 6 path: admin/settings/date-time • Description: It contains settings for the default time zone for the site, whether or not users can set their own time zone, the default country, and the first day of the week • New settings: Drupal 7 adds the ability to... here from Drupal 6 to Drupal 7 Development The development section gives you access to settings that allow you to get more information about the workings of your site as well as allowing you to monitor and configure performance-related settings You can also access the automated test system from this section [ 111 ] Drupal 7 Administration Logging and errors The details are as follows: • Drupal 7 path:... settings have changed substantially from Drupal 6 In Drupal 7, users can have fields and you can configure what happens when a user account is disabled We will review these changes thoroughly in just a few pages [ 116 ] Chapter 4 Roles The details are as follows: • Drupal 7 path: admin/config/people/roles • Drupal 6 menu location: Administer | User management | Roles • Drupal 6 path: admin/user/roles • Description:... • Drupal 7 path: admin/config/development/maintenance • Drupal 6 menu location: Administer | Site configuration | Site maintenance • Drupal 6 path: admin/settings/site-maintenance • Description: Allows you to close the site temporarily while running maintenance tasks or upgrading the site • New settings: This functionality is unchanged from Drupal 6 Performance The details are as follows: • Drupal 7. .. access rules in Drupal 6 In Drupal 7, you cannot block entire ranges of IP addresses If you need to block a large number of IP addresses, you should block them either in an htaccess file or in your firewall The new page appears as follows: Profiles The details are as follows: • Drupal 7 path: admin/config/people/profile • Drupal 6 menu location: Administer | User management | Profiles • Drupal 6 path: . actions in Chapter 7. Shortcuts The details are as follows: • Drupal 7 path: admin/config/regional/system/shortcut. • Drupal 6 menu location: N/A. • Drupal 6 path: N/A. Drupal 7 Administration [. all of the Drupal modules that are available in Drupal core. Chapter 4 [ 109 ] Conguring settings The majority of the settings are the same from Drupal 6 to Drupal 7. Let's look at each. you wish to use. Drupal 7 Administration [ 114 ] Image styles The details are as follows: • Drupal 7 path: admin/config/media/image-styles. • Drupal 6 menu location: N/A. • Drupal 6 path: N/A. •