2012/11/19

Plone Theme Upgrade

記錄 Plone 3 昇級到 Plone 4 的經驗,特別是處理舊式 Theme 的情況。先到 ZMI portal_view_customization, portal_skins/custom 如果有客製化的程式碼,或是有相依的 portlet 設定值,都要先移除,再到 Plone Setup 設定 Theme 為 Plone Default,再到 Add-ons 把舊的模組取消安裝。

備份 Data.fs 以防意外,把這個 Plone 3 的 Data.fs 搬到 Plone 4 的新系統 var/filestorage 目錄裡,啟動系統後,到 ZMI 執行 portal_migration。到 portal_skins 的 Properties 把舊模組的 Skin 設定值刪除。

如果不幸遇到 PicklingError: Can't pickle <class 'Products.OldPkg.browser.interfaces.IThemeSpecific'>: import of module Products.OldPkg.browser.interfaces failed,只好試試 wildcard.fixpersistentutilities

2012/11/17

plone.app.jquery Upgrade

Plone 4.2.2 預設的 plone.app.jquery 版本是 1.4.4,想要單獨昇級 jQuery 版本的話,可以在 versions.cfg 直接指定 plone.app.jquery = 1.7.1.1,再執行 buildout:

$ bin/buildout -c develop.cfg
Getting distribution for 'zc.recipe.testrunner==1.2.1'.
zip_safe flag not set; analyzing archive contents...
Got zc.recipe.testrunner 1.2.1.
Uninstalling zopeskel.
Uninstalling zopepy.
Uninstalling instance.
Installing _mr.developer.
Generated script '/home/marr/plone422/zinstance/bin/develop'.
Installing instance.
Getting distribution for 'plone.app.jquery==1.7.1.1'.
Got plone.app.jquery 1.7.1.1.
Generated script '/home/marr/plone422/zinstance/bin/instance'.
Installing zopepy.
Generated interpreter '/home/marr/plone422/zinstance/bin/zopepy'.
Installing zopeskel.
Generated script '/home/marr/plone422/zinstance/bin/zopeskel'.
Generated script '/home/marr/plone422/zinstance/bin/paster'.
Installing omelette.
Updating backup.
Updating chown.
chown: Running echo Dummy references to force this to execute after referenced parts
echo /home/marr/plone422/zinstance/var/backups
chmod 600 .installed.cfg
find /home/marr/plone422/zinstance/var -type d -exec chmod 700 {} \;
chmod 744 /home/marr/plone422/zinstance/bin/*
Dummy references to force this to execute after referenced parts
/home/marr/plone422/zinstance/var/backups
Installing test.
Generated script '/home/marr/plone422/zinstance/bin/test'.
Updating repozo.
Updating unifiedinstaller.
*************** PICKED VERSIONS ****************
[versions]

*************** /PICKED VERSIONS ***************

直接或間接用到 jQuery 的模組至少有:Products.CMFPlone, collective.z3cform.datetimewidget, plone.app.jquerytools, plone.app.controlpanel, plonetheme.sunburst, archetypes.querywidget。

PloneTheme Bootstrap

Responsive Design 已成顯學,也有人把 Bootstrap 和 Plone 整合,範例成果像是 diazotheme.bootstrapplonetheme.bootstrap

plonetheme.bootstrap Screenshot

由於 Diazo 技術已經成熟,視覺設計成果可以壓成 zip 檔,上傳給 Plone 直接套用。專門展示 Plone Theme 的 plonethemes.org 網站,同時也收集這些 zip 檔,方便設計師和工程師進行整合工作。

2012/11/14

Sahana Internship Program

Sahana Software Foundation 在 2012 十二月到 2013 三月,推出線上實習計畫讓全球學生參與,在教練的指導下,實習生將學習完成數個軟體開發任務,整個實習期間,平均每週花上四小時,順利結業的話,會頒與實習證明和美金 500 元。

實習名額有三位:包括兩名軟體開發實習生,一名媒體行銷實習生。原則上要開發的是 Sahana Eden 系統軟體,它是以 Python 語言及 Web2Py 框架寫成,學習過程將認識這些細節。

有興趣報名的學生,請將履歷及下列問題的資訊,一併寄到 internship@sahanafoundation.org:

  • 申請實習的理由是?
  • 自認有哪些經歷可能有助於實習工作?
  • 實習期間有何承諾與規劃?
  • 想申請軟體開發實習的話,請附上 GitHub 個人網址。
  • 想申請媒體行銷實習的話,請附上個人文件連結,或是 blog 和參與社群的資訊。

當然,事先了解更多關於 Sahana 人道救援系統的資訊,肯定對申請實習會有幫助。

2012/11/05

Plone True Gallery

collective.plonetruegallery 是 Plone 展示圖檔的優秀模組,在 2.1 版本之後支援 Products.Collage,頁面的展示效果就更加豐富。

Flickr 和 Picasa 相簿的整合,是另一個很棒的功能,新版仍然保有這項特色,但程式碼將被獨立出來,要到 collective.ptg.flickrcollective.ptg.picasa 尋找安裝。

2012/10/30

Quotes Of The Day

Summarized from http://bytes.com/topic/python/answers/28338-python-productivity-gain

They say that when you have a hammer, everything looks like a nail. When using Python, most everything is a nail.

using a tool like Python doesn't just influence the programmers, but the whole project! If prototyping and coding in general becomes significantly faster, the trade off for how much analysis and design you should do will change. Why spend weeks at a conference table arguing about different design alternatives if the programmers can supply several different implementations within a day?

Python is designed with the objective of making it easy to do the right thing, rather than making it difficult to do the wrong thing.

And Python just "felt" clean. I can't explain it very well, but Python's syntax just never got in the way of my reading, which left me free to concentrate all my attention on what the code was actually doing.

2012/10/26

Plone Isotope jQuery Plugin

isotope 是一個 jQuery plugin,可以呈現炫麗的網頁畫面。下列是我把範例檔案嵌進 Plone 網站的心得和步驟。
解開 isotope-site.zip 原始檔後,先觀察目錄結構和 index.html 內容:
isotope-site/
├── CONTRIBUTING.mdown
├── README.mdown
├── css
│   └── style.css
├── custom-layout-modes
│   ├── big-graph.html
│   ├── category-rows.html
│   ├── centered-masonry.html
│   ├── masonry-column-shift.html
│   ├── masonry-corner-stamp.html
│   ├── masonry-gutters.html
│   └── spine-align.html
├── demos
│   ├── adding-items.html
│   ├── basic.html
│   ├── combination-filters.html
│   ├── elements-complete.html
│   ├── elements-partial.html
│   ├── filtering.html
│   ├── fluid-responsive.html
│   ├── hash-history.html
│   ├── images.html
│   ├── infinite-scroll.html
│   ├── layout-modes.html
│   ├── relayout.html
│   ├── removing.html
│   └── sorting.html
├── docs
│   ├── adding-items.html
│   ├── animating.html
│   ├── extending-isotope.html
│   ├── filtering.html
│   ├── hash-history-jquery-bbq.html
│   ├── help.html
│   ├── introduction.html
│   ├── layout-modes.html
│   ├── license.html
│   ├── methods.html
│   ├── options.html
│   └── sorting.html
├── index.html
├── jquery.isotope.js
├── jquery.isotope.min.js
├── js
│   ├── fake-element.js
│   ├── jquery-1.7.1.min.js
│   ├── jquery.ba-bbq.min.js
│   ├── jquery.infinitescroll.min.js
│   └── make-big-graph-projects.js
├── pages
│   ├── 2.html
│   ├── 3.html
│   ├── 4.html
│   ├── 5.html
│   └── 6.html
└── tests
    ├── callbacks.html
    ├── combo-sort-history.html
    ├── destroy.html
    ├── elements-complete-test.html
    ├── flash.html
    ├── index.html
    ├── item-position-data.html
    ├── jquery-animation.html
    ├── no-items.html
    ├── onlayout.html
    ├── right-to-left.html
    ├── tiny-text.html
    └── unclickable-filtered.html

7 directories, 62 files
首先,把 JavaScript 和 CSS 檔案上傳到 ZMI 的 /portal_skins/custom 目錄,至少有三個檔案:

  1. jquery-1.7.1.min.js - 這個檔案在原始檔的 js 目錄裡找得到,從 ZMI 下拉選單點選 File 來新增。
  2. jquery.isotope.min.js - 仿照上述方式上傳。
  3. style.css - 這個檔案在原始檔的 css 目錄裡找得到,從下拉選單點選 DTML Method 來新增。由於 Plone 原本也有 style.css 同名稱的檔案,為避免衝突,我改用 isotope.css 名稱來上傳。
再到 ZMI 的 portal_css 新增 stylesheet 設定值,在這個例子裡,名稱就是上述新增的 isotope.css 檔案。

接著,要選一個「網頁」位址,來實際展示畫面,實作方法很多種,以根目錄為例,我是在 ZMI 根目錄裡新增一個 Page Template,請留意,這裡的 Id 要指定為 index_html,系統發現目錄裡有這類名稱時,會優先執行它,index_html 內容先複製自 Sunburst main_templage.pt 檔案,可參考這系列 gist 的第一次版本

這時候的畫面,很可能會變得清爽,主內容的區塊全部清空了:

我們想把 Plone Demo 字樣換掉,也就是改用新標題。從 ZMI 根目錄點選剛才建立的 index_html 檔案,在 Title 欄位填上 Python Periodic Table 當作新標題:

還要修改一段程式碼才能真的生效,把 <h1> 改成 TAL 敘述式,讀取 template/title 變數值:

重頭戲上場了,要把原始碼 index.html 內容嵌入 Page Template 裡。依序是:
接下來是許多微調的動作,特別是要把檔案路徑、CSS 衝突或不適宜的設定值改掉,例如:
如果 poortal-column-content 的 CSS class 改用 width-full 的話,可以擁有全螢幕的顯示效果。