OpenWiki是用ASP編寫的WIKI引擎中比較優秀的,而且還是開源的項目。它的架構設計的非常精巧,是學設程序設計不可多得的範例。
OpenWiki的工作流程
ow.asp是OpenWiki的入口程序,負責 解析指令,調用相關的action 通過(owactions.asp),找出相關頁的數據從數據庫中通過(owdb.asp),然後生成xml stream(ToXml() method),並根據 xsl 將xml stream轉換成 html stream送出通過(owtransformer.asp)。
OpenWiki的程序模塊
owconfig_default.asp: 參數設置文件。
owall.asp: 將各個模塊包含進來的總控文件。
owpreamble.asp: 全局各個常量定義文件。
owprocessor.asp: 處理核心
owpatterns.asp: init the RegExpr pattern contants.
owwikify.asp: 格式轉換.
owvector.asp: 實現可變數組類: Vector.
owregexp.asp: 函數 s,m在這裏定義: These functions simulate the m and s operations as available in the programming language perl. You can usually literally copy perl regular expressions and expect them to work with these functions.
owtoc.asp: 定義 TableOfContents 類。
owactions.asp: 規定動作
owdb.asp: 定義Namespace 類
owpage.asp: 與 WikiPage 相關的類
owdiff.asp: 比較兩個文件的異同,我稍微擴充就完全可以作爲版本控制的核心。
my/myactions.asp: 自定義動作
OpenWiki的數據庫表結構
下面以ms sql的表爲例來註解。
CREATE TABLE [openwiki_attachments] (
[att_wrv_name] [nvarchar] (128) NOT NULL ,
[att_wrv_revision] [int] NOT NULL ,
[att_name] [nvarchar] (255) NOT NULL ,
[att_revision] [int] NOT NULL ,
[att_hidden] [int] NOT NULL ,
[att_deprecated] [int] NOT NULL ,
[att_filename] [nvarchar] (255) NOT NULL ,
[att_timestamp] [datetime] NOT NULL ,
[att_filesize] [int] NOT NULL ,
[att_host] [nvarchar] (128) NULL ,
[att_agent] [nvarchar] (255) NULL ,
[att_by] [nvarchar] (128) NULL ,
[att_byalias] [nvarchar] (128) NULL ,
[att_comment] [text] NULL
)
CREATE TABLE [openwiki_attachments_log] (
[ath_wrv_name] [nvarchar] (128) NOT NULL ,
[ath_wrv_revision] [int] NOT NULL ,
[ath_name] [nvarchar] (255) NOT NULL ,
[ath_revision] [int] NOT NULL ,
[ath_timestamp] [datetime] NOT NULL ,
[ath_agent] [nvarchar] (255) NULL ,
[ath_by] [nvarchar] (128) NULL ,
[ath_byalias] [nvarchar] (128) NULL ,
[ath_action] [nvarchar] (20) NOT NULL
)
CREATE TABLE [openwiki_cache] (
[chc_name] [nvarchar] (128) NOT NULL ,
[chc_hash] [int] NOT NULL ,
[chc_xmlisland] [text] NOT NULL
)
CREATE TABLE [openwiki_interwikis] (
[wik_name] [nvarchar] (128) NOT NULL ,
[wik_url] [nvarchar] (255) NOT NULL
)
//頁面內容, //主鍵 [wpg_name] (頁面名)
CREATE TABLE [openwiki_pages] (
[wpg_name] [nvarchar] (128) NOT NULL ,
[wpg_lastmajor] [int] NOT NULL ,
[wpg_lastminor] [int] NOT NULL ,
[wpg_changes] [int] NOT NULL
)
// 頁面不同版本的內容 //主鍵 [wrv_name] + [wrv_revision]
CREATE TABLE [openwiki_revisions] (
[wrv_name] [nvarchar] (128) NOT NULL ,
[wrv_revision] [int] NOT NULL ,
[wrv_current] [int] NOT NULL ,
[wrv_status] [int] NOT NULL ,
[wrv_timestamp] [datetime] NOT NULL ,
[wrv_minoredit] [int] NOT NULL ,
[wrv_host] [nvarchar] (128) NULL ,
[wrv_agent] [nvarchar] (255) NULL ,
[wrv_by] [nvarchar] (128) NULL ,
[wrv_byalias] [nvarchar] (128) NULL ,
[wrv_comment] [nvarchar] (1024) NULL ,
[wrv_text] [ntext] NULL
)
CREATE TABLE [openwiki_rss] (
[rss_url] [nvarchar] (256) NOT NULL ,
[rss_last] [datetime] NOT NULL ,
[rss_next] [datetime] NOT NULL ,
[rss_refreshrate] [int] NOT NULL ,
[rss_cache] [ntext] NOT NULL
)
CREATE TABLE [openwiki_rss_aggregations] (
[agr_feed] [nvarchar] (200) NOT NULL ,
[agr_resource] [nvarchar] (200) NOT NULL ,
[agr_rsslink] [nvarchar] (200) NULL ,
[agr_timestamp] [datetime] NOT NULL ,
[agr_dcdate] [nvarchar] (25) NULL ,
[agr_xmlisland] [ntext] NOT NULL
)
ALTER TABLE [openwiki_attachments] WITH NOCHECK ADD
CONSTRAINT [PK_openwiki_attachments] PRIMARY KEY NONCLUSTERED
(
[att_wrv_name],
[att_name],
[att_revision]
) WITH FILLFACTOR = 90 ON [PRIMARY]
ALTER TABLE [openwiki_cache] WITH NOCHECK ADD
CONSTRAINT [PK_openwiki_cache] PRIMARY KEY NONCLUSTERED
(
[chc_name],
[chc_hash]
) WITH FILLFACTOR = 90 ON [PRIMARY]
ALTER TABLE [openwiki_interwikis] WITH NOCHECK ADD
CONSTRAINT [PK_openwiki_interwikis] PRIMARY KEY NONCLUSTERED
(
[wik_name]
) WITH FILLFACTOR = 90 ON [PRIMARY]
ALTER TABLE [openwiki_rss] WITH NOCHECK ADD
CONSTRAINT [PK_openwiki_rss] PRIMARY KEY NONCLUSTERED
(
[rss_url]
) WITH FILLFACTOR = 90 ON [PRIMARY]
ALTER TABLE [openwiki_rss_aggregations] WITH NOCHECK ADD
CONSTRAINT [PK_openwiki_rss_aggregations] PRIMARY KEY NONCLUSTERED
(
[agr_feed],
[agr_resource]
) WITH FILLFACTOR = 90 ON [PRIMARY]
ALTER TABLE [openwiki_attachments] ADD
CONSTRAINT [FK_openwiki_attachments_openwiki_revisions] FOREIGN KEY
(
[att_wrv_name],
[att_wrv_revision]
) REFERENCES [openwiki_revisions] (
[wrv_name],
[wrv_revision]
)
OpenWiki是非常好的ASP的WIKI,只是對中文支持不好,所以很少有人用。現在中文問題終於被解決了。最新的中文修正版是由威狼維護的並提供源碼下載,詳情關注http://www.wizwolf.com/club/ShowForum.asp?forumid=11
這是在英文openwiki 0.78sp1基礎上的修改版。修改了中文鏈接的問題。並做了部分漢化。