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,只是对中文支持不好,所以很少有人用。现在中文问题终于被解决了。最新的中文修正版是由威狼维护的并提供源码下载,这是在英文openwiki 0.78sp1基础上的修改版。修改了中文链接的问题。并做了部分汉化。