Tabbed Block 0.5

Originally want to patch v0.4, but to solve the problems of image button in IE, huge code restructure is performed. so v0.5 is the version number.
Also, this version fixed the bug that self-defined block cannot show their correct title.
There is no change in database, so to install, just place all the files into %drupal%/module/tabbed_block

原本打算只補丁v0.4, 但因為在IE 上的image 按鈕出現問題, 整個處理表單的流程完全改變, 所以命名為v0.5
這版本同時修正: 自定義的block 標題錯誤
這版本升級只需要將zip 內的檔案放到%drupal%/module/tabbed_block 就可以了, 並沒有資料庫上的變更

Taxonomy upgrade extras: 

Title length overflow

IE7在設定頁裡,如果區塊的標題超過某個字數時,Existing block區裡的那個標題名稱只會出現空白,然後點選上下移動連結會出現錯誤訊息:Error! Debug information: Array.
這個錯誤在firefox不會出現,上下移動的動作正常,但是區塊的標題會出現Error! empty subject in block aggregator-feed
,點選該區塊只會出現 Nothing here.


在 /var/www/http/includes/ 的第 218 行: call_user_func_array() []: First argument is expected to be a valid callback, 'tabbed_block_admin_settings' was given 。

2007-04-25 Tabbed Block v0.4 development (continue)

連日的開發, 修改了幾個問題
包括AJAX errors, IE 相容問題

AJAX 錯誤發生在tabbed_block.js 內,
如果用戶沒有使用jstools 模組就會發生問題
主要因為AJAX 的請求路徑(request url)使用了jstools 的一個add-on, Drupal.url()
原本錯誤地假定Drupal.url 為Drupal 內建(.....名字上的誤會, 但Drupal 的確內建了 Drupal 對象, 只是jstools 加強了Drupal 對象)
改用tabbed_block.module 內

("var base_path = ".drupal_to_js(base_path()).";" , "inline" )

將base_path 傳到js 內使用

IE href 屬性:
IE 相容問題, 除了CSS 上, tabs 更是使用不能
問題出自tabbed_block.js 一段jquery:
....略, 38行

  click = $(this).children("a").attr("href");

39行的變數 click, 目的在取出a 的href
用作找回相應的div content
在firefox 上, 值為source code 內的值
但在IE 上, 值為一個絕對路徑(
令40行找不到一個 的div
用javascript 的字符函數取出解決

另, 停用IE anchor:
IE 的anchor 不可以在jquery內用 return false 停用(停止自動滾動)
改用inline 的方式

<a href="#frag1" onclick="return false;">tab head1</a>

在Drupal 內顯示錯誤:
某些可以預計的錯誤使用print_r + exit() 處理
但為了一般使用者方便, 及一體性
轉為使用drupal 內建的錯誤顯示方式:
( print_r $_POST , "error")

patched 的v0.41 待測試後發佈

「tabbed block module 可以使用多於一block」
類似adsense module
但改code 將會頗多, 會待v0.41 穩定下來再開發

After days of development, Tabbed Block module had fixed a couples of bugs,
include AJAX errors, incompatible in IE,
changes in UI when there is error....... etc etc

AJAX error happens inside file tabbed_block.js
If the user do not install jstools modules, problems happen.
It is because AJAX request path use a jstools add-on function call, Drupal.url()
which I assume the function is build-in Drupal (...misunderstand in naming. but Drupal did really have a build-in Drupal object, but jstools expanded it.)
It is solved by tabbed_block.module, a line

("var base_path = ".drupal_to_js(base_path()).";" , "inline" )

using it to pass the base path(request path) to js

IE href properties:
incompatible in IE, other than CSS, more important is failure in using tabs.
the bug is a line from jquery from file tabbed_block.js, line 39:
....etc etc, line 38:

  click = $(this).children("a").attr("href");

line 39 variable click, aim to get the attribute href,
finding the corresponding div
in FF, it returns the value in source code,
while in IE, it return absolute path: (
causing line 40 cannot find a div with id
it is solved by parsing the return string by string methods in js.

Also, disable IE anchor:
the anchor cannot be disabled by returning false from jquery
but a inline method works:

<a href="#frag1" onclick="return false;">tab head1</a>

Display errors inside Drupal:
originally, becoz of the convience for development,
some predictable errors use print_r + exit() to catch
but as release goes, more focus is put on end-user,
so it changed to Drupal-style:
( print_r $_POST , "error")

And some other addings in comments,
patched v0.41 will be release after test

The coming feature that will be added is "multi-block",
like adsense module.
And it is required by many users,
but the change in code will be huge,
so it will start after v0.41 is stable.