Plone 4 Way to Get Icon

昇級 Plone 4 的過程,發現有些 content type icon 沒有顯示,在 log 裡找到線索:
WARNING Plone Deprecation Warning
The icon for the 'controlpanel/DropdownConfiguration' action
was obtained from the action icons tool.
The action icons tool has been deprecated
and will be removed in Plone 5.
You should register action icons directly on the action now,
using the 'icon_expr' setting.
繼續追查後,原來 icon 存取方式已經改變,在 CMF 2.2.0-alpha 正式引入新的方式,而 Plone 4 使用 CMF 2.2.0 版本,自然也受到影響。如果到 ZMI 裡的 portal_actionicons 查看比較,會發現大有不同。


Plone 4 Upgrading

目前 Plone 4 處於 beta 2 階段,測試 Plone 3 昇級的結果,還算順利,值得一提的訊息有:
INFO PythonScripts Some of your Scripts have stale code cached.
Since Zope cannot use this code, starup will be slightly slower
until these Scripts are edited.
You can automatically recompile all Scripts that have this problem
by visiting /manage_addProduct/PythonScripts/recompile
of your server in a browser.
ERROR PortalTransforms Cannot register transform rtf_to_html,
using BrokenTransform: Error Unable to find binary "rtf-converter"
工作原理和以前一樣,把 Data.fs 放到新版環境裡的 var/filestorage 再啟動,同樣有 dry run mode 提示,但整體的介面訊息變得更清楚。
目前遇到的狀況是 webcouturier.dropdownmenu 在昇級後,造成 LocationError: (None, 'html_tag') 的錯誤訊息,來源之一是 webcouturier/dropdownmenu/browser/dropdown_recurse.pt Line 29, Column 12。事先把 dropdownmenu 模組停用,就可以避掉這問題。
另外,可能會遇到 Default Theme 跳到 Unstyled 的狀態,只要進 plone_control_panel 或 @@skins-controlpanel 指定為佈景主題為 Plone Classic Theme 或 Sunburst Theme 就搞定。


Changing Tabs with Viewlet

在 Plone 的 Navigation Settings 裡,利用 automatically generate tabs 的設定,可以在 portal-globalnav 區域自動產生根目錄的 tab 項目,如果只想限定目錄自動產生為 tab 項目,那就把 Generate tabs for items other than folders 取消勾選,如果某個自動產生的目錄 tab 項目,不希望它出現在 portal-globalnav 區域,除了取消自動產生 tab 項目的方式外,還可以動手修改 viewlet 來達成。

上述的 portal-globalnav 名稱,是從 CSS 角度來稱呼它,用 firebug 查得到它在 CSS 檔案的位置,如果是從 viewlet 角度來稱呼它,它的名稱是 global_sections。

例如根目錄有個名稱為 tmp 的目錄,不希望它出現在 portal-globalnav 區域,到 portal_view_customizations 裡的 plone.global_sections 加個 tal:condition 就行:
<ul id="portal-globalnav">
<tal:tabs tal:repeat="tab view/portal_tabs">
<li tal:attributes="
id string:portaltab-${tab/id};
class python:view.selected_portal_tab==tab['id']
and 'selected' or 'plain'">
<a href=""
tal:condition="python: tab['id'] != 'tmp'"
tal:attributes="href tab/url;
title tab/description|nothing;">
Tab Name
想要知道有哪些 viewlet 以及它們的位置,可使用 http://localhost:8080/Plone/@@manage-viewlets 之類的網址來查詢。


Quotes of the Day

"The best way to keep learning after you leave school is surround yourself with the smartest people you can find."

"If you want to build a ship, don't drum up men to collect wood and don't assign them tasks and work, but rather teach them to long for the endless immensity of the sea."

"Understanding how to write well and effectively communicate the nuances of your thoughts is the most important thing you will learn in school."

"I would have written a shorter letter if I'd had the time." -- Mark Twain

"Great leaders are great teachers. And great teachers are great storytellers."

"If you want to be a leader, you will teach. The two are inseparable."

"As leaders, you learn more by listening than by talking. Listening makes you mor humble, more intuitive, and smarter. Talking does none of these things."

"When you listen, you learn how things work as opposed to when you talk and state how you thing things work."

"If you must talk, ask questions."

"If we have data, let's look at the data. If all we have are opinions, let's go with mine." -- Jim Barksdale

"You shouldn't be able to figure out the pecking order or org chart by looking at a product."

"There is no such thing as a minor lapse of integrity." -- Tom Peters

"I have no special talent. I am only passionately curious." -- Albert Einstein

"Nothing great was ever achieved without enthusiasm."

"Team are not juries locked in a room until they reach a unanimous verdict. Don't spend hours in endless meetings striving for unanimity. Consensus is not unanimity. Guide the team to declare when 'good enough' is better."

"The perfect is the enemy of the good, from which there is no progress."

"If everyone is thinking alike, then somebody isn't thinking." -- George Patton

"Where there is harmony, there is no innovation."

"Innovation comes from creativity. Creativity cannot be managed. It can be allocated, it can be budgeted, it can be measured, it can be tracked and encouraged, but it can't be dictated."

"If you're the innovator, you're like a virus. The antibodies want to kill you.
Leaders protect people from antibodies."

"A leader's job is not to prevent risk, but to build the capability to recover when failures occur. There is no such thing as a good failure and a bad failure. Or there is such a thing as a good failure and a bad failure. A good one happens quickly, and it provides plenty of lessons. Sometimes you have to look at these lessons in the data. A bad failure takes a long time and you don't learn anything. Leaders don't prevent failures. They prevent bad failures."

"Learn something new so that you can remember how hard it is to learn."

"Teach something so you can learn."

"Humility is correlated with age. Arrogance is inversely correlated with age."

"As smart leader, you surround yourself with great people. You people understand what they're doing better than you do."

"Good judgment comes from experience, and a lot of that come from bad judgment." -- Will Rogers

"Show me a team that never makes a mistake, and I'll show you a team that has never done anything innovative."

"Smart people can smell hypocrisy, so think before you act or speak. You have to commit to your team's goal and vision? They can tell when you don't really mean it."

"Setting an example is not the main means of influencing another, it is the only means." -- Albert Einstein

"If you would not work for yourself, why do your people?"

All are from Rules to Success by Jonathan Rosenberg.


Plone3 Theme

概念Plone3 Theme 包括 template (page template)、stylesheet (CSS)、image 三種類型,以及 browser、skin 兩種機制。剛接觸 Plone 的朋友,先從修改 image 和 CSS 下手,比較容易入門。

以 CSS 為例,開發的準備工作之一,要將 Plone 執行模式設定成 debug mode 而非 production mode,也就是 parts/instance/etc/zope.conf 檔案的內容,要有下列的設定結果:
debug-mode on
這樣 CSS 修改結果才能馬上生效,而不會受到 cache 和 compression 的影響。

在 ZMI 的 plone_skins/plone_styles 裡,找得到 ploneCustom.css 檔案,預設是個空白範例,可以用來測試設定效果。想要修改它,先確定下拉選單的選項是 custom,再按 Customize 鈕,這樣會把這份灰底設定檔複製到 portal_skins/custom 目錄,並打開在網頁上等待編輯。值得留意的是,僅管下列內容看似是註釋文字,但它們是會被執行的程式碼,通常不該被刪除:
/* <dtml-with base_properties> (do not remove this :) */
/* <dtml-call "REQUEST.set('portal_url', portal_url())"> (not this either :) */

/* </dtml-with> */
除此之外的 /* */ 內容都是註釋文字,要刪要留,悉聽尊便。

#visual-portal-wrapper {
background: #aaaaaa url(&dtml-portal_url;/banner.jpg) no-repeat top left;
margin-left: auto !important;
margin-right: auto !important;
width: 900px !important;
還有 sectional CSS 的範例,可以單獨修改首頁的顯示方式。更多的資訊,可參考 Plone 3 Theming 書籍。