2009/12/09

Adding Portal Actions

Plone 的 content type 預設會顯示 Send this 和 Print this 的 document action 項目,如果想要新增一個 Google this 項目,該怎樣做呢?



在 ZMI 裡 portal_actions/document_actions 新增 CMF Action 項目,先要填寫識別碼。



以 google 為例,再點選進入填寫更多細節,範例如下:

Title: Google this
I18n Domain: plone
URL (Expression): string:javascript:(function(){open('http://www.google.com.tw/search?q=' +encodeURIComponent(document.title)+'&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a','google','toolbar=no,width= 700,height=250')})()
Permissions: View
Visible?: true



按 Save Changes 鈕後就會直接生效。

有些細節值得留意。即使沒做翻譯的動作,像是 I18n Domain 最好要填,預設是 plone。在 URL (Expresion) 欄位裡常用的變數有:

$portal_url - 例 string:${portal_url}/news
$object_url - 例 string:${object_url}/addtoFavorites
$globals_view - 例 string:${globals_view/navigationRootUrl}

No comments: