Drupal 6 có gì mới?

@Updted: Greg Knaddison (greggles) có thực hiện đoạn video 21' giới thiệu các tính năng mới trong Drupal 6.

Drupal càng ngày càng tốt hơn. Dưới đây là danh sách các thay đổi trong mã nguồn Drupal phiên bản từ 5 lên 6.

  1. Bỏ module Drupal, thay vào đó là module OpenID, nhiều ưu điểm hơn.
  2. Thêm Schema API, làm việc với CSDL đơn giản hơn rất nhiều.
  3. Nâng cấp thư viện jQuery mới nhất: 1.2.1
  4. Thêm module update status, tự động kiểm tra các phiên bản mới hợp lệ.
  5. Hỗ trợ trigger và action: cấu hình một số thao tác khi một node được tạo
  6. Cải thiên module taxonomy:
    • Có phần mô tả cho mỗi term. Phần này sẽ hiển thị ở trang taxonomy/term/x cũng như ở RSS feed
    • Lưu lại cấu hình taxonomy khi tạo bản duyệt (revision) mới cho node.
  7. Cải thiện forum:
    • Kiểu nội dung nào bây giờ cũng có thể lôi vào diễn đàn.
  8. Thao tác trên tập tin (upload) có các cải tiến:
    • Lưu lại mã số người upload file (có thể viết module kiểm tra quota của từng người dễ dàng hơn)
    • Có thể tạo hoặc xóa các file tạm khi chạy cron job
  9. Năng suất:
    • Module nhân được tách ra làm các file .inc phụ, nhằm giảm code dư thừa (anonymous không cần tải code quản lý block, taxonomy, ...)
    • Khả năng nén mã javascript (Drupal 5 có nén CSS). Tuy nhiên, việc viết mã Javascript đòi hỏi phải chặt chẽ hơn (một chút).
    • Đệm block: cải thiện cho anonymous và authenticated users.
  10. Thêm vào bộ lọc HTML corrector:
    • Sửa lại những HTML dởm
    • Tự động đóng thẻ ở bản cắt (teaser)
  11. Bộ cài đặt:
    • Theme garland được trình làng ngay ở quá trình cài đặt
    • Có thể cấu hình thông tin site ở installing time
    • Có thể thêm nhiều step ở quá trình cài đặt (thích hợp cho các công ty làm web đây!)
    • Nhập vào bản dịch được tích hợp
  12. Tổ chức lại update.php
  13. Hệ thống giao diện (theme system)
    • Thêm các tập tin .info cho các theme, dễ dàng hơn để định nghĩa thêm các region, chức năng của theme.
    • Theme vào theme registry: các module có thể cung cấp các tập tin giao diện .tpl.php mà không cần tạo ra các hàm theme_* nữa
    • Sử dụng theme Garland cho quá trình cài đặt và thông báo Bảo trì hệ thống
    • Hỗ trợ các hàm có thể giao diện hóa (themable) trong javascript
  14. Tính tiện dụng:
    • Xác định bản cắt dễ dàng hơn ở trang soạn thảo
    • Thêm sticky table header (thử ở trang Access control, module management)
    • Bỏ tập tin default/settings.php - hệ thống sẽ tự tạo trong quá trình cài đặt.
    • Có thể cấu hình định dạng ngày giờ tùy biến
    • Nhớ lại tên người gửi phản hồi của anonymous user
    • Chỉ cho phép kích hoạt các module và theme khi chúng thật sự hợp lệ cho phiên bản mới
    • Có thể xác định phiên bản PHP thích hợp với module ở tập tin .info
    • Kiểm tra động độ an toàn và hợp lệ của mật khẩu
    • Làm lại trang điều hành poll
  15. Di chuyển "PHP input filter" vào một module riêng
  16. Những cải tiến của hệ thống ngôn ngữ:
    • Hỗ trợ các ngôn ngữ viết từ phải sang trái (Hebrew, Greek)
    • Nhận dạng ngôn ngữ dựa trên các phần của URL
    • Xác định ngôn ngữ của một node
    • Hỗ trợ dịch node sang các ngôn ngữ khác
    • Ngôn ngữ phụ thuộc các path aliases
    • Tự động nhập vào bản dịch khi thêm vào các ngôn ngữ mới
    • Giao diện dịch thuật Javascript
    • Tự động nhập vào bản dịch tương ứng khi kích hoạt các module
  17. Lọc URL aliases ở trang điều hành alias
  18. Chữ ký của người dùng:
    • Trở thành một tùy chọn, có thể tắt
    • Có thể giao diện hóa
  19. Thêm scripts/drupal.sh thực hiện Drupal code ở giao diện dòng lệnh
  20. Hệ thống menu hoàn toàn mới
  21. Form API 3.0
  22. Hệ thống watchdog mới

Theo Drupal change logs

Comments

New ip_address() function

New ip_address() function when working behind proxies.

There is a new function, ip_address() that should be used instead of the superglobal $_SERVER['REMOTE_ADDR']. When Drupal is run behind a reverse proxy, the address of the proxy server will be in this superglobal for all users, and hence many parts of Drupal will log the wrong IP address for the client. This function makes deducing the client IP address transparent, whether a proxy is used or not. It is recommended that you replace all $_SERVER['REMOTE_ADDR'] with ip_address().

New user_mail_tokens() method

New user_mail_tokens() method

user.module now provides a user_mail_tokens() function to return an array of the tokens available for the email notification messages it sends when accounts are created, activated, blocked, etc. Contributed modules that wish to make use of the same tokens for their own needs are encouraged to use this function.

New image.inc function: image_scale_and_crop()

image_scale_and_crop() scales an image to the exact width and height given. The required aspect ratio is maintained by cropping the image equally on both sides, or equally on the top and bottom. No image toolkit changes are required.

JavaScript themeing

There is now a themeing mechanism for JavaScript code. Together with the automatically included script.js, this allows theme developers more freedom in the domain of scripted events on Drupal webpages. Often, JavaScript code produces markup that is inserted into the page. However, this HTML code has usually been hardcoded into the script, which did not allow alteration of the inserted code.

Modules provide default theme functions in the Drupal.theme.prototype namespace. Themes should place their override functions directly in the Drupal.theme namespace. Scripts call Drupal.theme('function_name', ...) which in turn decides whether to call the function provided by the theme (if present) or the default function.

JavaScript theme functions are entirely free in their return value. It can vary from simple strings, up to complex data types like an object containing in turn several jQuery objects which are wrapped around DOM elements. See the original (default) theme function to see what your custom theme function should return.

Drage and drop

Hỗ trợ kéo thả ở các trang quản lý: blocks, menu items, taxonomy terms, profile fields.

[JS] Tự động thêm biến Drupal.settings.basePath

Làm việc với javascript trong Drupal 5, chúng ta thưởng phải tự thêm vào biến Drupal.settings.basePath. Ở phiên bản 6, Drupal sẽ tự động thêm vào biến này, khi hàm drupal_add_js () được gọi ít nhất một lần.

Thay thế chuỗi

Có thể thay thế một chuỗi thông qua biến được khai báo ở settings.php

<?php
# ...
$conf['locale_custom_strings_en']['My String'] = 'My New String';
# ...
?>

New drupal_alter() function for developers

Dữ liệu của một module có thể được mở rộng cho các module khác thao tác lên cách dễ dàng nhờ hàm drupal_alter():

  1. $data = array();
  2. $data['#my_property'] = 'Some data!';
  3. $data['#my_other_property'] = 'More data...';
  4. drupal_alter('my_data', $data);
  5.  
  6. // Do your stuff here...

Với đoạn code như trên, các module có thể định nghĩa hàm hook_my_data_alter () để sử dụng/thao tác nội dung biến $data. Nhờ hàm mới này, việc alter lên một form trong hệ thống đã được cải thiện:

  • Ở Drupal 5, muốn alter lên một form, chỉ có một cách duy nhất là sử dụng hook_form_alter.
  • Ở Drupal 6, muốn alter lên một form, ngoài cách sử dụng hook_form_alter, chúng ta còn có thể sử dụng hook_{form_id}_alter, {form_id} là ID của form muốn được alter.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <sup> <br> <p> <h3>
  • Lines and paragraphs break automatically.
  • Link to content with [[some text]], where "some text" is the title of existing content or the title of a new piece of content to create. You can also link text to a different title by using [[link to this title|show this text]]. Link to outside URLs with [[http://www.example.com|some text]], or even [[http://www.example.com]].
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.