恢复MT 控制台密码

这篇文章 描述了从DB 恢复MT 控制台密码的方法。 $ perl -e "print crypt('password', 'ac');" mysql> update mt_author set author_password...

这篇文章 描述了从DB 恢复MT 控制台密码的方法。

$ perl -e "print crypt('password', 'ac');"

mysql> update mt_author set author_password = '???' where author_name = 'XXX';

使用print 出来的字符串替换"???","XXX" 是登录用户名。然后使用"password" 作为密码即可登录。

"password"  与 "ac"  可随意更改。

MT 3.33 至MT3.34

升级的好处 我就不多说了,这里介绍一点升级过程中的tips。 比较文件 将程序解压、解包之后放入与上一版本同级的目录,取名mt3.34 ./mt ./mt3.34 上一版本因为额外安装有插件以及个别hack文件,不能完整替换,先比较两个目录,使用-q 参数忽略具体文件差异,-r 递归子目录。 $ diff -qyr mt3.34 mt |grep...

升级的好处 我就不多说了,这里介绍一点升级过程中的tips。

比较文件

将程序解压、解包之后放入与上一版本同级的目录,取名mt3.34

./mt
./mt3.34

上一版本因为额外安装有插件以及个别hack文件,不能完整替换,先比较两个目录,使用-q 参数忽略具体文件差异,-r 递归子目录。

$ diff -qyr mt3.34 mt |grep Only 

Only in mt: mt-config.cgi
Only in mt3.34: mt-config.cgi-original
Only in mt/php/extlib/smarty: .cvsignore
Only in mt/php/plugins: block.MTBlogrollCategories.php
Only in mt/php/plugins: block.MTBlogrollLinkCategories.php
Only in mt/php/plugins: block.MTBlogrollLinkIfTagged.php
Only in mt/php/plugins: block.MTBlogrollLinkIfUpdated.php
Only in mt/php/plugins: block.MTBlogrollLinkTags.php
Only in mt/php/plugins: block.MTBlogrollLinks.php
Only in mt/php/plugins: block.MTBlogrollTags.php
Only in mt/php/plugins: function.MTBlogrollCategoryCount.php
Only in mt/php/plugins: function.MTBlogrollCategoryDesc.php
Only in mt/php/plugins: function.MTBlogrollCategoryDescription.php
Only in mt/php/plugins: function.MTBlogrollCategoryID.php
Only in mt/php/plugins: function.MTBlogrollCategoryLabel.php
Only in mt/php/plugins: function.MTBlogrollLinkBlogAuthor.php
Only in mt/php/plugins: function.MTBlogrollLinkCategory.php
Only in mt/php/plugins: function.MTBlogrollLinkDate.php
Only in mt/php/plugins: function.MTBlogrollLinkDesc.php
Only in mt/php/plugins: function.MTBlogrollLinkDescription.php
Only in mt/php/plugins: function.MTBlogrollLinkID.php
Only in mt/php/plugins: function.MTBlogrollLinkModifiedDate.php
Only in mt/php/plugins: function.MTBlogrollLinkName.php
Only in mt/php/plugins: function.MTBlogrollLinkPriority.php
Only in mt/php/plugins: function.MTBlogrollLinkRel.php
Only in mt/php/plugins: function.MTBlogrollLinkTarget.php
Only in mt/php/plugins: function.MTBlogrollLinkURI.php
Only in mt/php/plugins: function.MTBlogrollLinkURL.php
Only in mt/php/plugins: function.MTBlogrollLinkUpdated.php
Only in mt/php/plugins: function.MTBlogrollTagCount.php
Only in mt/php/plugins: function.MTBlogrollTagID.php
Only in mt/php/plugins: function.MTBlogrollTagName.php
Only in mt/php/plugins: function.MTBlogrollTagRank.php
Only in mt/php/plugins: plugins
Only in mt/plugins: Ajaxify
Only in mt/plugins: Blogroll
Only in mt/plugins: CheckLinks
Only in mt/plugins: Collect
Only in mt/plugins: FlickrPhotos
Only in mt/plugins: TagSupplementals.pl
Only in mt/plugins: mt-archive-dateheader.pl
Only in mt/plugins: mt-varz.pl

合并文件 

然后将上一版本多出或者更新日期更新的文件copy 到新版本,为了保险起见,使用-i 参数确认任何文件覆盖。

$ cp -iur  mt/plugins/* mt3.34/plugins 

 然后手动编辑合并曾经hack 过的文件,在这里我曾经修改了mysql.pm 以及批量编辑basename 所需的相关文件。

$ diff  mt3.34/lib/MT/ObjectDriver/DBI/mysql.pm mt/lib/MT/ObjectDriver/DBI/mysql.pm

1c1
< # Copyright 2001-2007 Six Apart. This code cannot be redistributed without
---
> # Copyright 2001-2006 Six Apart. This code cannot be redistributed without
5c5
< # $Id: mysql.pm 1003 2007-01-05 23:46:47Z gboggs $
---
> # $Id: mysql.pm 653 2006-08-04 19:33:48Z bchoate $
63c63
<             $driver->{dbh}->do("SET NAMES " . $c) or
---
>             $driver->{dbh}->do("SET NAMES " . $c) or
99a100
>     $driver->{dbh}->do("SET NAMES 'utf8'");

 

可以使用vi 同时编辑多个文件,使用:n 与:N 命令进行切换,剪贴板缓冲区是共享的,方便copy 代码行。

$ vi   mt3.34/lib/MT/ObjectDriver/DBI/mysql.pm   mt/lib/MT/ObjectDriver/DBI/mysql.pm

批量编辑basename 一般在大规模迁移时才会用到,这次就不修改了。

cgi-bin 目录的所有升级就完成了,把mt-statics copy 到相应目录,重复以上步骤。

版本切换 

全部完成后,把两组新旧目录名称迅速交换,再打开MT控制台,发现升级已经生效,没遇到任何错误,算是无缝切换。 

Get rollable entry list in MT - postroll.js

Most of blogers have the recent entry list at the sidebar. Sometime it's difficult to...

Most of blogers have the recent entry list at the sidebar. Sometime it's difficult to balance spacing and convenience. People may want more entries in the list, but they may also want to see other feature area without rolling scrollbar too much. I wrote a Javascript postroll.js that make the entry list rollable as far as you expect.

How does it work? Download postroll.js to your web server path and include it in your web page that you need the feature. Then edit your tempate like below. The template code is a little thick but works.

<h2>最近更新|Recent Entries</h2>
<div id="recententry" class="module-content">
<ul id="recententry1">
<MTEntries lastn="5">
<li><$MTInclude module="Entry Link"$></li>
</MTEntries>
</ul>
<MTEntries offset="5" lastn="1">
<MTIfNonEmpty tag="EntryTitle"><$MTSetVar name="recententry2" value="1"$></MTIfNonEmpty>
</MTEntries>
<MTIf name="recententry2">
<ul id="recententry2">
<MTEntries offset="5" lastn="5">
<li><$MTInclude module="Entry Link"$></li>
</MTEntries>
</ul>
</MTIf>
<MTEntries offset="10" lastn="1">
<MTIfNonEmpty tag="EntryTitle"><$MTSetVar name="recententry3" value="1"$></MTIfNonEmpty>
</MTEntries>
<MTIf name="recententry3">
<ul id="recententry3">
<MTEntries offset="10" lastn="5">
<li><$MTInclude module="Entry Link"$></li>
</MTEntries>
</ul>
</MTIf>
<MTEntries offset="15" lastn="1">
<MTIfNonEmpty tag="EntryTitle"><$MTSetVar name="recententry4" value="1"$></MTIfNonEmpty>
</MTEntries>
<MTIf name="recententry4">
<ul id="recententry4">
<MTEntries offset="15" lastn="5">
<li><$MTInclude module="Entry Link"$></li>
</MTEntries>
</ul>
</MTIf>
<MTEntries offset="20" lastn="1">
<MTIfNonEmpty tag="EntryTitle"><$MTSetVar name="recententry5" value="1"$></MTIfNonEmpty>
</MTEntries>
<MTIf name="recententry5">
<ul id="recententry5">
<MTEntries offset="20" lastn="5">
<li><$MTInclude module="Entry Link"$></li>
</MTEntries>
</ul>
</MTIf>
<label id="recententrybar1"></label><label id="recententrybar2"></label>
<!--end #recententry-->
</div> 
 The emphasis must be followed in your code, otherwise need to configure yours in postroll.js.
// Configuration
Postroll = {
box: ["recententry"],
bar1: ["recententrybar1"],
bar2: ["recententrybar2"],
bar1_txt: "&nbsp;&nbsp;&laquo;&nbsp;&nbsp;&nbsp;&nbsp;",
bar2_txt: "&nbsp;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;",
bar1_lnk_title: "Previous 5 entries",
bar2_lnk_title: "Next 5 entries"
};

Then have this style in the css. I don't use script to initial the style because this method is quicker for the page first loading. There won't be a long entry list at a moment then hided by the script. I use script to initial the text link for rolling entries and control the entry roll after all stuffs were loaded.

#recententry2,
#recententry3,
#recententry4,
#recententry5 {
display: none;
} 

There's more action you need to take if want it works perfect! Create a file name as ie_onload.js, and have below only line. About ie_onload.js here's an explanation.

 try{Postroll.run()}catch(e){} 

This script is able to serve multi-area in one page. That case you should have the configuration like below. It could be 3 groups or more.

 // Configuration
Postroll = {
box: ["recententry", "othertag"],
bar1: ["recententrybar1", "othertagbar1"],
bar2: ["recententrybar2", "othertagbar2"]
bar1_txt: "&nbsp;&nbsp;&laquo;&nbsp;&nbsp;&nbsp;&nbsp;",
bar2_txt: "&nbsp;&nbsp;&nbsp;&nbsp;&raquo;&nbsp;&nbsp;",
bar1_lnk_title: "Previous 5 entries",
bar2_lnk_title: "Next 5 entries"
};

Update 2007-02-14 

I found that there's one post missed on each 5 posts in the postroll list. The point is that I had  wrong offset value in MTEntries tag. I've updated the template code above from offset="6" to offset="5" and also for the value of 11, 16 and 21.

无法删除MT widget 默认module的问题

升级MT3.3 以后多了不少plugin,其中包括Widgets Manager,Widget 这个词最近在Blog 出现频率很高,也不知道到底是何物,今天google了一下,才知道大部分人谈论的Widget 与我要了解的MT Widget 还不是一回事。 这里有篇文章详细介绍:使用Movable Type的Widgets,我就不废话了。只说一个奇怪的问题,Widget Manager 会在Template 的Module 中生成默认的Widget 可以利用的Module,我已经有了很多类似的Module,于是把已有的Module重命名,在名称前面加上"Widget: "...
升级MT3.3 以后多了不少plugin,其中包括Widgets Manager,Widget 这个词最近在Blog 出现频率很高,也不知道到底是何物,今天google了一下,才知道大部分人谈论的Widget 与我要了解的MT Widget 还不是一回事。 这里有篇文章详细介绍:使用Movable Type的Widgets,我就不废话了。只说一个奇怪的问题,Widget Manager 会在Template 的Module 中生成默认的Widget 可以利用的Module,我已经有了很多类似的Module,于是把已有的Module重命名,在名称前面加上"Widget: " 前缀,这样就可以被Widget Manager 识别,然后将默认的全部删除,但是下一次点击Manage my Widgets进入后,这些默认的Module 又会自动生成,没有找到解决办法,最后将我自己的Module修改成与默认的具有相同的名字(大小写敏感),才算了事。

重构MT模板结构

MT默认的模板包含大量的重复或者类似模板代码,当你需要进行一处模板修改时,也许不得不考虑得更多,并在多个模板中同时进行,已达到统一的效果。 模板重构的目的就是尽可能将多个模板之间相同的部分抽象出来,然后在多个模板中进行引用,另外还有趋向于将一组具有相同功能的模板代码放入同一个模板文件 的作用,从而减少模板修改带来的工作量。MT很早就在模板中支持Module,定义好的Module可以通过如下代码进行引用。 <$MTInclude module="Module Name"$> 我 们需要做的就是把重复的模板代码放在一个个Module中进行定义,然后在模板中去引用他们。经过一定的重构,模板的重用性得到一定的改观,但依然会有一 些冗余的代码,除非MT可以提供一些模板标签,能够让我们判断当前所在的模板而采用不同的Module或者调整细微的模板代码差别。幸运的是,我找到了一 个MT plugin,mt-varz version 0.31。 它提供了更高级的变量支持,支持以下模板标签: <$MTGetVar$>,...

MT默认的模板包含大量的重复或者类似模板代码,当你需要进行一处模板修改时,也许不得不考虑得更多,并在多个模板中同时进行,已达到统一的效果。 模板重构的目的就是尽可能将多个模板之间相同的部分抽象出来,然后在多个模板中进行引用,另外还有趋向于将一组具有相同功能的模板代码放入同一个模板文件 的作用,从而减少模板修改带来的工作量。MT很早就在模板中支持Module,定义好的Module可以通过如下代码进行引用。

<$MTInclude module="Module Name"$>

我 们需要做的就是把重复的模板代码放在一个个Module中进行定义,然后在模板中去引用他们。经过一定的重构,模板的重用性得到一定的改观,但依然会有一 些冗余的代码,除非MT可以提供一些模板标签,能够让我们判断当前所在的模板而采用不同的Module或者调整细微的模板代码差别。幸运的是,我找到了一 个MT plugin,mt-varz version 0.31。 它提供了更高级的变量支持,支持以下模板标签:

<$MTGetVar$>, <MTSetVarBlock>, <MTIf>, <MTUnless>, <MTIfOne>, <MTUnlessEmpty>, <MTUnlessZero>

其中部分标签在MT3.3中已经得到支持, mt-varz对其进行了over load,具体细节可以参考此plugin文档(在下载包内)。我们在这里需要用到MT标准标签MTSetVar,以及mt-varz 支持的MTIf 标签。我在每个模板的第一行使用MTSetVar 定义一个变量用于标识当前模板,然后在Module中需要的地方使用MTIf 判断当前模板,并注入相应模板代码。下面是一个例子:

Template: Category Archive

<$MTSetVar name="Category Archive" value="1"$> 
...
<$MTInclude module="Header"$>
...

Template Module: Header

<head>
<MTIf name="Category Archive">
<title><$MTBlogName encode_html="1"$>: <$MTArchiveTitle$> Archives</title>
</MTIf>
...
</head> 
<$MTSetVar name="Category Archive" value="1"$> 这里value 可以是其它非0值,如果值为1,那么MTIfOne 标签在上面与MTIf 标签的作用相同,加以利用可以进行更精细的控制。除了1以外,目前还不提供对变量值的详细判断。

经过重构之后,我的Main Index 模板看起来就像这个样子,其它也很类似,模板修改主要在少量的Module中进行。

<$MTSetVar name="Main Index" value="1"$>
<$MTInclude module="Template Header"$> 
<$MTInclude module="Header"$>  
<MTEntries>
<$MTInclude module="Entry"$>
</MTEntries>
<$MTInclude module="Footer"$>
<$MTInclude module="Template Footer"$>  

更新:经测试,<MTIfOne> 标签不能正确的解析内嵌的<MTElse> 标签,根据不同情况,将在模板rebuild 阶段抛出错误,或者rebuild 通过,但逻辑不符合嵌套关系。下面是一个逻辑错误示例。<MTIf>标签是否存在此问题未作测试。已经report 这个bug 给了Appnel,希望可以解决。

<MTIfOne name="Search Result Template"><MTIfTagSearch>Tag Search<MTElse>None Tag Search</MTElse></MTIfTagSearch></MTIfOne>

列出不定期更新的日志

我有一些这样的日志,需要长期更新,不断追加内容,或者内容经常变化,需要不定期进行更新。它们很容易就被新的日志淹没,从而增加了查找定位的成本。对于这样的日志,我希望可以将它们固定的列在blog边栏,方便随时查看和修改。有两种方法可以方便的实现: 为这部分日志指定共同的分类(categories) 为这部分日志指定共同的标签(tags) 指定分类的方法,将会额外增加一个blog分类,可能是不期望的,不过也可能正是使用者所期望的,我采用了第二种指定tags的方法。MT3.2 开始,MTEntries模板标签新增了tag参数,用于列出具有特定tag的日志。MT中以"@"开头的tags会被隐藏,不会在MTTags 模板标签中列出,但这个标签在其它方面与一个真正的标签没有任何区别,比如可以用来关联主题相似的日志。我为这部分日志指定了一个永远不会被其它日志用到的标签,并加上了"@"作为前缀。然后在边栏增加一下模板代码来生成这部分日志的列表。 <h3>不定期更新|Handy Entries</h3> <div class="module-content"> <ul> <MTEntries tag="@_handy"> <li><$MTInclude module="Entry...

我有一些这样的日志,需要长期更新,不断追加内容,或者内容经常变化,需要不定期进行更新。它们很容易就被新的日志淹没,从而增加了查找定位的成本。对于这样的日志,我希望可以将它们固定的列在blog边栏,方便随时查看和修改。有两种方法可以方便的实现:

  1. 为这部分日志指定共同的分类(categories)
  2. 为这部分日志指定共同的标签(tags)

指定分类的方法,将会额外增加一个blog分类,可能是不期望的,不过也可能正是使用者所期望的,我采用了第二种指定tags的方法。MT3.2 开始,MTEntries模板标签新增了tag参数,用于列出具有特定tag的日志。MT中以"@"开头的tags会被隐藏,不会在MTTags 模板标签中列出,但这个标签在其它方面与一个真正的标签没有任何区别,比如可以用来关联主题相似的日志。我为这部分日志指定了一个永远不会被其它日志用到的标签,并加上了"@"作为前缀。然后在边栏增加一下模板代码来生成这部分日志的列表。

<h3>不定期更新|Handy Entries</h3>
<div class="module-content">
<ul>
<MTEntries tag="@_handy">
<li><$MTInclude module="Entry Link"$></li>
</MTEntries>
</ul>
</div> 
Template Module Entry Link:
<a href="<$MTEntryPermalink$>" title="<MTEntryIfTagged>Tags: <MTEntryTags glue=", "><$MTTagName$></MTEntryTags><MTElse>No tags</MTElse></MTEntryIfTagged> "><$MTEntryTitle$></a> 

importing rss feed from msn spaces to movable type

Yueyue is migrating her blog from msn spaces to movable type . It's a real...

Yueyue is migrating her blog from msn spaces to movable type . It's a real difficult thing. Msn spaces have a limited number of post in the rss feed. Yueyue didn't find any option to overcome this limitation. So it's difficult to have the entire rss feed for importing. Here's a discussion(Chinese) on this issue and gave a way: Get the rss feed then remove the posts in this feed, then get the rss feed again and plus to previous feed, then remove... untill get the entire feed. It works, but really takes time if you have a long list. Anyhow, you would have it! We go to Movable Type.

MT builds in import/export feature but it only works on his own format, rss x.0 is not supported yet. We can not import the msn rss feed directly. I had a solution for it. I write a macro file for UltraEdit that read a msn rss feed file and convert it to MT import/export format. After the convert ion, you could save the output as a new file for importing use.

AUTHOR, ALLOW COMMENTS, CONVERT BREAKS and ALLOW PINGS are set default value, you could change them before your importing. DATE might not match your requirement if you have different timezone settings between msn spaces and movable type. Another point, in this case the same charset setting(UTF-8 here) is taken for both side movable type and msn spaces. If you have different setting between them, must do additional charset convertion for the feed file. this could be done within UltraEdit. Unfortunaly some convertion only available in UltraEdit menu but not in Macro. So we have to do it manually.

Output example: 

AUTHOR: #authorname          
TITLE: importing rss feed from msn spaces to movable type
ALLOW COMMENTS: 1            
CONVERT BREAKS: 1            
ALLOW PINGS: 1               
PRIMARY CATEGORY: essay      
DATE: 11/23/2006 03:42:07    
-----                        
BODY:                        
<p>Yueyue is migrating her blog from ...
-----                        
--------                     

UltraEdit tool is necessary for running this macro file. The macro could be used on migrating other rss 2.0 feed  to movable type with little change.

msn_feed2mt.mac

InsertMode
ColumnModeOff
HexOff
UnixReOff
Top
Find RegExp "<generator>Microsoft Spaces v[0-9.]+</generator>"
IfNotFound
ExitMacro
EndIf
Top
Find RegExp "^n"
Replace All ""
Find RegExp "<^?xml*</cf:listinfo>"
Replace All ""
Find RegExp "<item><title>Photo Album:*</item>"
Replace All ""
Find RegExp "<item><title>Custom List:*</item>"
Replace All ""
Find RegExp "<item><title>Music List:*</item>"
Replace All ""
Find RegExp "<item><title>Blog List:*</item>"
Replace All ""
Find RegExp "</channel></rss>"
Replace All ""
Find RegExp "<link>*</link>"
Replace All ""
Find RegExp "<guid*</guid>"
Replace All ""
Find RegExp "<comments>*</comments>"
Replace All ""
Find RegExp "<slash:comments>*</slash:comments>"
Replace All ""
Find RegExp "<msn:type>*</msn:type>"
Replace All ""
Find RegExp "<live:type>*</live:type>"
Replace All ""
Find RegExp "<live:typelabel>*</live:typelabel>"
Replace All ""
Find RegExp "<dcterms:modified>*</dcterms:modified>"
Replace All ""
Find "<item>"
Replace All ""
Find "</item>"
Replace All ""
Find "&lt;"
Replace All "<"
Find "&gt;"
Replace All ">"
Find RegExp "<title>^(*^)</title><description>^(*^)</description><category>^(*^)</category><pubDate>^(*^)</pubDate>"
Replace All "^nAUTHOR: #authorname^nTITLE: ^1^nALLOW COMMENTS: 1^nCONVERT BREAKS: 1^nALLOW PINGS: 1^nPRIMARY CATEGORY: ^3^nDATE: ^4^n-----^nBODY: ^n^2^n-----^n--------"
Find RegExp "%DATE: *, ^([0-9]+^) ^([a-zA-Z]+^) ^([0-9]+^) ^(*^) GMT$"
Replace All "DATE: ^2/^1/^3 ^4"
Find RegExp "%DATE: Jan*/"
Replace All "DATE: 01/"
Find RegExp "%DATE: Feb*/"
Replace All "DATE: 02"
Find RegExp "%DATE: Mar*/"
Replace All "DATE: 03/"
Find RegExp "%DATE: Apr*/"
Replace All "DATE: 04/"
Find RegExp "%DATE: May/"
Replace All "DATE: 05/"
Find RegExp "%DATE: Jun*/"
Replace All "DATE: 06/"
Find RegExp "%DATE: Jul*/"
Replace All "DATE: 07/"
Find RegExp "%DATE: Aug*/"
Replace All "DATE: 08/"
Find RegExp "%DATE: Sep*/"
Replace All "DATE: 09/"
Find RegExp "%DATE: Oct*/"
Replace All "DATE: 10/"
Find RegExp "%DATE: Nov*/"
Replace All "DATE: 11/"
Find RegExp "%DATE: Dec*/"
Replace All "DATE: 12/" 

For getting rss feed on msn spaces, it needs to turn the option Syndicate this space On within msn spaces setting.

Yueyue have another place blogcn need to migrate. The rss feed from blogcn is more clear than msn spaces. But it's in GB2312. I made changes on the macro file as below that works for blogcn's rss feed. Following step must be taken after the macro process: File -> Conversions -> ASCII to UTF-8 (Unicode Editing), then save. Or you have other way to do the charset convertion.

InsertMode
ColumnModeOff
HexOff
DosToUnix
UnixReOff
Top
Find RegExp "<rss version="
IfNotFound
ExitMacro
EndIf
Top
Find RegExp "^p"
Replace All ""
Find RegExp "<^?xml*</dc:language>"
Replace All ""
Find RegExp "</channel></rss>"
Replace All ""
Find RegExp "<link>*</link>"
Replace All ""
Find RegExp "<guid*</guid>"
Replace All ""
Find RegExp "<comments>*</comments>"
Replace All ""
Find "<item>"
Replace All ""
Find "</item>"
Replace All ""
Find RegExp "<author>^(*^)</author>*<title><!^[CDATA^[^(*^)]]></title>*<pubDate>^(*^)</pubDate>*<description>*<!^[CDATA^[^(*^)]]>*</description>"
Replace All "^nAUTHOR: ^1^nTITLE: ^2^nALLOW COMMENTS: 1^nCONVERT BREAKS: 1^nALLOW PINGS: 1^nPRIMARY CATEGORY: #blogcn^nDATE: ^3^n-----^nBODY: ^n^4^n-----^n--------"
Find RegExp "%DATE: ^([0-9]+^)-^([0-9]+^)-^([0-9]+^) ^(*^)$"
Replace All "DATE: ^2/^3/^1 ^4"

upgrade to TinyMCE 2.09

TinyMCE new version 2.09 came. What's the new feature? Let's have a compare with the 2.02....
TinyMCE new version 2.09 came.

What's the new feature?

Let's have a compare with the 2.02.

The interface with full features of 2.02

TinyMCE 2.02 full feature Interface

The interface with full features of 2.09 

TinyMCE 2.09 full feature interface

Lots of changes, include: (I only list the changes which are most important for me. I didn't check the change logs, this info just for reference. )

  • New fullscreen mode, I'm editing on this mode, like it very much!
  • New tags supported
    • cite
    • abbr
    • del
    • ins
    • acronym
  • New development kit, powerful and helpfule!
  • Some tiny changes, such as:
    • nicer formating on HTML source window.
    • won't link the followed text after a link new generated.

Development kit interface

TinyMCE Development kit interface

This kit interface is able to collsape and expand.

Download and Upgrade in MT

Donwload the package file at here. Unpackage it and prepare to upgrade. Here's the steps:

  • Backup the old directory and files.
mt-static\plugins\Ajaxify\tinymce\
\cgi-bin\mt\plugins\Ajaxify\EnhancedEntryEditing.pl (You won't have and don't need to backup this file if you don't use the plugin EnhancedEntryEditing.) 
  • Replace all things in mt-static\plugins\Ajaxify\tinymce\ with the new version.
  • Open \cgi-bin\mt\plugins\Ajaxify\EnhancedEntryEditing.pl to edit. (no need do this if you don't have.)
  • Comment out all old settings from last installation within:
    settings => new MT::PluginSettings([
        ['tinymce_config', { Default => q{
        old setttings here
        }}]
    ]),

 

  • Copy new settings from the source(View->Page Source) of mt-static/plugins/Ajaxify/tinymce/examples/example_full.htm to the place of old settings.

    settings => new MT::PluginSettings([
        ['tinymce_config', { Default => q{
        /* old settings here */
        new setttings here
        }}]
    ]),
  • Make some neccesory changes on the new settings.
mode : "textareas",
mode : "exact"
elements : "text,text_more",
content_css : "example_full.css",
content_css : "/css/extend.css",

  • Save changes, then logon MT management to new an entry(might need a refresh here, F5), the new interface will take effect.
  • Done!

Here's the new interface in MT, a little fat for MT got overflow, but not a big problem. Enjoy it!

TinyMCE 2.09 interface in MT

The full code section in \cgi-bin\mt\plugins\Ajaxify\EnhancedEntryEditing.pl

settings => new MT::PluginSettings([
['tinymce_config', { Default => q{
/** This section was used by TinyMCE v2.01
mode : "exact",
elements : "text,text_more,excerpt",
theme : "advanced",
plugins : "iespell, emotions, inlinepopups",
theme_advanced_blockformats : "p,h1,h2,h3,h4,h5,h6",
theme_advanced_buttons1 : "formatselect,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,undo,redo,separator,link,unlink,separator,image,emotions,iespell,help",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],span[class|align|style]",
force_p_newlines : true,
relative_urls : false,
remove_script_host : false,
button_tile_map : true,
ask : false,
auto_cleanup_word : true,
theme_advanced_path_location : "bottom",
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false,
safari_warning: false,
oninit: "quicktagsHide"
**/
/** This section was used by TinyMCE v2.02
//mode : "textareas",
mode : "exact",
elements : "text,text_more",
//editor_selector : "mceEditor",
theme : "advanced",
//plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
plugins : "table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
//theme_advanced_buttons1_add_before : "save,separator",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_data/example_link_list.js",
external_image_list_url : "example_data/example_image_list.js",
flash_external_list_url : "example_data/example_flash_list.js",
content_css : "/css/extend.css",
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false,
oninit: "quicktagsHide"
**/
/** This section was used by Tiny MCE v2.09 **/
//mode : "textareas",
mode : "exact",
elements : "text,text_more",
theme : "advanced",
plugins : "devkit,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
theme_advanced_buttons1_add_before : "save,newdocument,separator",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor,advsearchreplace",
theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,|,visualchars,nonbreaking",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
content_css : "/css/extend.css",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_link_list.js",
external_image_list_url : "example_image_list.js",
flash_external_list_url : "example_flash_list.js",
media_external_list_url : "example_media_list.js",
file_browser_callback : "fileBrowserCallBack",
theme_advanced_resize_horizontal : false,
theme_advanced_resizing : true,
nonbreaking_force_tab : true,
apply_source_formatting : true
}}]
]), 

 

Refine and add new features to my web site

This site disappeared on Internet from the early of this year because of the server...

This site disappeared on Internet from the early of this year because of the server problem. Since then it's running on my thinkpad locally for 1 year. Now it's more like my personal blog. I have to have some refine work on my blog since I decided to publish it again. Also I added some new features.

Here's a work log.

upgrade MT to version 3.3 

changed to plugined tinymce


changed title appearance

There are 3 level Titles.

  1. site title
  2. category and monthly title
  3. entry title

Each pages have this title structure for search engine friendly, but only display the related title. Others are hided.

In the 2nd level pages, the site title is hided. Also in the 3rd level pages, both 1st level and 2nd level titles are hided.

Using style:

.subindex-container .index-logo,
.individual-container .index-logo,
.individual-container .subindex-logo {
display: none;
}

gave tags to each entry

Give one or more meaningful tags to each entry. The old keywords field is abandoned. 

neater monthly archive list

added keywords.js

I used keyword.js to hilight keywords which visitor used in search engine for linking in this page in my old site. I did some simple configure and add it into my blog.

I had following settings. 

// Configuration:
Keyword = {
hilite: true,
index: false,
refill1: true,
refill2: false,
element1: 'search',
element2: 'w', 
style_name: 'hilite',
style_name_suffix: true,
debug_referrer: '',
debug_meta: ''
};

added edit link to individual archive

Simply to add an edit link to individual entry view, that makes editing entries quicker without going to MT management first.

Add following code to individual template:

<a href="<$MTCGIPath$>mt.cgi?__mode=view&_type=entry&id=<$MTEntryID$>&blog_id=<$MTBlogID$>" title="edit this entry, only for admin">Edit</a> 

changed download files location 

I organized all download files by date instead of by categories. That reduces the length of the file list in a same directory.

Current directory structure rule is /ref/year/month/files, exam:

/ref/2006/12/simple.zip

fixed new line problem for entries 

recheck the broken links

I have been using Xenu to check broken site links. It's still a good solution up to now. Recently, I got another solution that could play part of role of Xenu, CheckLinks. It's a plugin for MT that only check the links they are within entries. The reason I picked it up is that It's easier to have the edit link in the bad links report by CheckLinks. Here's a report from my site.  For having this feature, I use below Template. This template is used for checking all entries(maximum 9999 here) in your blog and printing only the entries with bad links. But rebuilding this template is as slow as when you check through your blog links with other tool. So better to uncheck the "Rebuild this template automatically when rebuilding index templates" at template setting if you are using it in Indexes Template. 

<MTEntries lastn="9999">
<MTCheckLinks include_local="1">
<MTCheckLinksHere>
<$MTEntryBody$>
<$MTEntryExtended$>
</MTCheckLinksHere>
<MTIfBadLinks>
<dl class="badlinks">
<dt><a href="<$MTEntryLink$>"><$MTEntryTitle$></a> (<a href="<$MTCGIPath$>mt.cgi?__mode=view&_type=entry&id=<$MTEntryID$>&blog_id=<$MTBlogID$>" title="in <$MTCatetoryTitle$>">edit</a>) Have bad links:</dt>
<MTBadLinks load_entries="1">
<dd><$MTBadLinkStatus trim_to="3"$>: <$MTBadLinkURL$> [<a href="<$MTBadLinkURL$>"><$MTBadLinkText$></a>]</dd>
</MTBadLinks>
</dl>
</MTIfBadLinks>
</MTCheckLinks>
</MTEntries> 

A note: If you are refering any Entries Tag like "MTEntryTitle" within CheckLinks Tag <MTBadLinks>, you must specify load_entries="1" otherwise there's error raising during rebuilding this template.

 

set up category rss feeds and links

managed external links by blogroll

I downloaded a new plugin Blogroll for managing my links. 

Use Blogroll I could manage and group my links, and publish them in template.

Using following code in template: 

<MTBlogrollCategories>   
<h3><$MTBlogrollCategoryLabel$></h3> 
<ul><MTBlogrollLinks> 
<li><a href="<$MTBlogrollLinkURI$>" title="<MTBlogrollLinkDesc>"<MTIfNonEmpty tag="BlogrollLinkRel"> rel="<MTBlogrollLinkRel>"</MTIfNonEmpty> <MTIfNonEmpty tag="BlogrollLinkTarget">target="<MTBlogrollLinkTarget>"</MTIfNonEmpty>><$MTBlogrollLinkName$></a></li> 
</MTBlogrollLinks></ul> 
</MTBlogrollCategories> 

related tags on tag search 

I downloaded a new plugin TagSupplymentals that brings much features on tags. I use MTRelatedEntries and MTRelatedTags.

Using following code in template:

<ul>
<h3>Related Entries</h3>
<MTRelatedEntries lastn="5">
<li><$MTInclude module="Entry Link"$></li>
</MTRelatedEntries>
</ul> 
 
<ul>
<h3>Related Tags</h3>
<MTEntryTags>
<MTRelatedTags>
<li><a xhref="<$MTTagSearchLink$>"><$MTTagName$></a> (<$MTTagCount$>)</li>
</MTRelatedTags>
</MTEntryTags>
</ul>

 

related entries by tags

See above. 

more clear search result

On the search result list, as default only show the entry title and entry summary. So the searcher could have an overview on all search result. If he wants more info about the entry there's a link to expand the entry area to show entry body.

Template:

<MTEntriesHeader>
<!--start #top-alpha-->
<div id="top-alpha">
<label id="hidebodybar" class="hidbodybar"></label>
<!--end #top-alpha-->
</div>
</MTEntriesHeader>
<!--start #entry~-->
<div class="entry" id="entry<$MTEntryID pad="1"$>">
<a name="a<$MTEntryID pad="1"$>" />

<!--start #top-entry~-->
<div class="top-entry" id="top-entry<$MTEntryID pad="1"$>">
<label class="hidebodybar" id="hidebodybar<$MTEntryID pad="1"$>"></label>
<!--end #top-entry~-->
</div>
<h3 class="entryheader" id="a<$MTEntryID pad="1"$>"><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></h3>
<!--start #entryinfo~-->
<div class="entryinfo" id="entryinfo<$MTEntryID pad="1"$>">
<MTIfOne name="Category Archive">
<p class="subtitle"><$MTEntryDate format="%x"$></p>
<MTElse>
<p class="subtitle">In <a href="<$MTEntryLink archive_type="Category"$>"><$MTEntryCategory$></a>, <$MTEntryDate format="%x"$></p>
</MTElse>
</MTIfOne>
<!--end #entryinfo~-->
</div>
<!--start #entrysummary~-->
<div class="entrysummary" id="entrysummary<$MTEntryID pad="1"$>">
<$MTEntryBody convert_breaks="0" words="16"$>...
<!--end #entrysummary~-->
</div>
<!--start #entrybody~-->
<div class="entrybody" id="entrybody<$MTEntryID pad="1"$>">
<$MTEntryBody convert_breaks="0"$>
<MTEntryIfExtended><p>继续阅读 "<a href="<$MTEntryPermalink$>#more"><$MTEntryTitle$></a>" 的剩余内容</p></MTEntryIfExtended>
<!--end #entrybody~-->
</div>
<!--start #entryfooter~-->
<div class="entryfooter" id="entryfooter<$MTEntryID pad="1"$>">
<MTEntryIfTagged><p>标签 Tags: 其它与<MTEntryTags glue=", "><a href="<$MTTagSearchLink$>"><$MTTagName$></a> (<$MTTagCount$>)</MTEntryTags> 相关的话题</p></MTEntryIfTagged>
<p class="posted">
Posted by <$MTEntryAuthorUsername$> at <$MTEntryDate format="%X"$>
<MTEntryIfAllowComments> | <a href="<$MTEntryPermalink archive_type="Individual"$>#comments">Comments (<$MTEntryCommentCount$>)</a></MTEntryIfAllowComments>
<MTEntryIfAllowPings> | <a href="<$MTEntryPermalink archive_type="Individual"$>#trackbacks">TrackBack (<$MTEntryTrackbackCount$>)</a></MTEntryIfAllowPings>
| <a href="<$MTCGIPath$>mt.cgi?__mode=view&_type=entry&id=<$MTEntryID$>&blog_id=<$MTBlogID$>" title="edit this entry, only for admin">Edit</a>
</p>
<!--end #entryfooter~-->
</div>
<!--end #entry-->
</div>

Javascript: hide-body.js

flexible style sheet

I had this new bar on the top of page.

text bar for changing style

It makes possible to switch different style sheet on current page by one click.

For doing this, needs switch-css.js, and the defination in the head.

<link rel="stylesheet" type="text/css" href="<$MTBlogURL$>css/screen.css" media="screen" title="BlockStyle" />
<link rel="alternate stylesheet" type="text/css" href="<$MTBlogURL$>css/screen-clearstyle.css" media="screen" title="ClearStyle" />
<script type="text/javascript" language="javascript" src="<$MTBlogURL$>switch-css.js"></script>
And the label tag with ID definition in the page. The css links would be generated by the .js above dynamically.
<label id="switchcssbar"></label>

The code refer to:

tested none-css appearance 

To see what my blog is like without style sheet, click below link. If you want to change it back, choose the block Style links on the top of any page. I'm ready to change this site as None Style

tested printable view

To see how it works, select "File - Print Preview" in your Internet Browser.

The format is defined in print.css .

made the old site work

Made some neccesary changes on my old site for showing it in sub folder well.

change to mysql database

power editing basename 

I think this would be helpful, lots of people want to have this feature. 

add style to preformatted tag <pre>

I used <pre> tag for several cases:

  • programming code (exam: javascripts)
  • command (exam: unix shell commands)
  • output (exam: screen output of a command)
  • refererence (exam: a short paragraph from other blog)

But they do have different requirements for showing up. So I add several class styles for the tag.

  • .code
  • .cmd
  • .output
  • .refer (with word wrap)

For the .refer class style, I referred to pre标签自动换行方案.

Update: Read an article What are semantics?, learned that I should use <blockquote> tag to wrap the resource that I refer to. So I need to use <blockquote> tag instead of class style .refer.

upgrade to TinyMCE 2.09

Refined Page structure

Refinced CSS

I split my css file as multi-level and use import keyword to link them up. I have following structure. The base.css and extend.css is used by each style sheet. The difference is that the extend.css is also refered by TinyMCE in MT. About TinyMCE please read this article .

base.css      extend.css
          \      /
           \    /
         screen.css
         screen-linestyle.css
         screen-clearstyle.css

I reset padding and margin as 0 in my base.css that makes crossing browsers development easier. Here's a style list about Firefox 1.5 default style sheet for HTML elements for reference.

I tried to have more comfortable color for pages. Here are some links would be helpful on this. The safe 216 web colors, a list of online colour tool.

 

Disable listing directory


Create a file ".htaccess" at the root path of web site and have following line:

Options All -Indexes 

Rewrite url for old site


Add below lines to /.htaccess.

RewriteEngine On
RewriteRule ^archives/([0-9]+/[0-9]+) $1
RewriteRule ^archives/(jeet_kune_do|outdoors) $1
RewriteRule ^archives/study_notes/(web|linux) $1
RewriteRule ^hobbies/(outdoors) $1
RewriteRule ^hobbies/ham/ amateur_radio
RewriteRule ^hobbies/sbenefit/ society_benefit
RewriteRule ^notes/*(db2|linux)* $1
RewriteRule ^notes/[a-z0-9\_\-]+.htm$ db2
RewriteRule ^archives/study_notes/[a-z0-9\_\-]+.html$ db2 
A little help on expression I used. 
  • ^ is maching the begin of aline.
  • $ is mathing the end of a line. 
  • $n is a reference for the expression within (), also could have $1, $2..., as I know, $0 should be the entire of $n.
  • | is the OR relationship.
  • + match at least one time.
Had this article  for reference. 

Related entries on tags

I had a plugin that allows having a related entries list in the same category. It's...

I had a plugin that allows having a related entries list in the same category. It's not very helpfule for visitors as you have many entries in a category.

Tags is supported since MT 3.3. We may want to have a related entries list based on tags on the current entry. TagSupplementals plugin is doing that. It provides a set of features for tags supplement. We're using one of them.

Change monthly archive style

The too long monthly archive list get bad-looking.Download a new plug-in mt-archive-dateheader to have a neat...

The too long monthly archive list get bad-looking.

Download a new plug-in mt-archive-dateheader to have a neat calendar for monthly archive like this:

kalsey-dates.gif

 

Change the template to

  <h2>按月归档|By Month</h2>

<a class="skip" xhref="http://blog.alex.com/cgi-bin/mt/mt.cgi#endbymonth">Skip over by month</a>

<MTArchiveList archive_type="Monthly">
<MTArchiveDateHeader>
<p><b><MTArchiveDate format="%Y"></b></p>
</MTArchiveDateHeader>
<a xhref="<$MTArchiveLink$>"><MTArchiveDate format="%B"></a><span class="num"><$MTArchiveCount$></span>
</MTArchiveList>
<p></p>

<a class="skip" id="endbymonth"></a>

Convert MT from Berkeley DB to MySQL

最近决定把MT的后台数据从Berkeley的文件DB转到MySQL。原因之一是使用关系数据库可以获得更多的灵活性,比如运行一条sql来变更 所有entry的某一个属性;另外一个原因是为了提前熟悉一下这个数据库,牙牙网站使用虚拟主机,DreamHost提供的数据库是MySQL,而我从前 主要使用了SQL Server,Oracle和DB2,Postgresql也只了解了一点,而MySQL则几乎没有接触过。下载了5.0.27安装文件,安装顺利,使用了第一个默认端口3306,UTF-8的数据库字符集。安装完成,运行了命令行客户端,输入help,给出的帮助命令不多,也没见到有关数据库创建的命令,便查了安装的帮助文件,组织的还算不错,很齐全,很快找到相关的命令:查看已有数据库show databases;连接数据库 testuse test;创建数据库 mtcreate database mt;接下来寻找把已有DB转化到MySQL的方法,很快找到一个第三方的工具mt-db-convert.cgi ,可以实现MT支持的几种不同的DB之间的转换。下载回来放到cgi-bin的mt目录,在浏览器访问运行,输入新创建的MySQL数据库名称mt,用户名root,密码,主机填入localhost,开始Convert。转换过程很快就完成了,不到1分钟,没有出现错误提示,转换信息如下:mt-db-convert.cgi($Rev: 173 $): Converting your MT...

最近决定把MT的后台数据从Berkeley的文件DB转到MySQL。原因之一是使用关系数据库可以获得更多的灵活性,比如运行一条sql来变更 所有entry的某一个属性;另外一个原因是为了提前熟悉一下这个数据库,牙牙网站使用虚拟主机,DreamHost提供的数据库是MySQL,而我从前 主要使用了SQL Server,Oracle和DB2,Postgresql也只了解了一点,而MySQL则几乎没有接触过。

下载了5.0.27安装文件,安装顺利,使用了第一个默认端口3306,UTF-8的数据库字符集。

安装完成,运行了命令行客户端,输入help,给出的帮助命令不多,也没见到有关数据库创建的命令,便查了安装的帮助文件,组织的还算不错,很齐全,很快找到相关的命令:

查看已有数据库
show databases;

连接数据库 test
use test;

创建数据库 mt
create database mt;

接下来寻找把已有DB转化到MySQL的方法,很快找到一个第三方的工具mt-db-convert.cgi ,可以实现MT支持的几种不同的DB之间的转换。

下载回来放到cgi-bin的mt目录,在浏览器访问运行,输入新创建的MySQL数据库名称mt,用户名root,密码,主机填入localhost,开始Convert。转换过程很快就完成了,不到1分钟,没有出现错误提示,转换信息如下:

mt-db-convert.cgi($Rev: 173 $): Converting your MT data between DB engines (for MT 3.2)

Loading database schema...

Loading data...
MT::Author
.
(1 objects saved.)

MT::Blog
..
(2 objects saved.)

MT::Trackback
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......
(327 objects saved.)

MT::Category
.......... .......... .......... .......... ..........
(50 objects saved.)

MT::Comment
..
(2 objects saved.)

MT::Entry
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... ....
(514 objects saved.)

MT::IPBanList

(0 objects saved.)

MT::Log
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......
(437 objects saved.)

MT::Notification

(0 objects saved.)

MT::Permission
....
(4 objects saved.)

MT::Placement
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... .......
(527 objects saved.)

MT::Template
.......... .......... .......... .......... .......... .......... .......... .......... ...
(83 objects saved.)

MT::TemplateMap
..........
(10 objects saved.)

MT::TBPing

(0 objects saved.)

MT::Session
.......... .......... .........
(29 objects saved.)

MT::PluginData

(0 objects saved.)

MT::Config
.
(1 objects saved.)

MT::FileInfo

(0 objects saved.)


Done copying data from DBM to DBI::mysql! All went well.

Your recommended setting
-------------------------------------
# DataSource R:/SITE/mt-db
ObjectDriver DBI::mysql
Database mt
DBUser root
DBHost localhost
DBPassword comein
-------------------------------------

然后修改mt-config.cgi文件,把数据源改成MySQL。 

再次访问MT,看起来一切正常,甚至原有的session都没有丢掉,只是后台使用的数据已经改变了位置。
不过发现了中文乱码问题,Google到了这个方法 ,按文修改后,需要再次执行mt-db-convert.cgi,把数据重新导入MySQL,再访问MT,乱码没有了,所有中文显示正常。

转换后又发现了一个新的问题,原DB中的Tags全部丢失,原因是mt-db-convert.cgi仅支持到MT 3.1,3.3的新功能带来的数据变化可能还会有其它信息丢失。

NOTE

This script is compatible with Movable Type version 3.1x. I didn't test it at any other versions.


其实MT自身已经提供了转换工具mt-db2sql.cgi,与mt.cgi在同一目录当中。使用方法是,安装好MySQL数据库服务,并创建好用于MT的DB,将MySQL数据库的配置信息加入mt-config.cgi,并同时保留原Berkeley DB的路径配置,即保持两种DB的配置同时生效,然后通过浏览器运行mt-db2sql.cgi,转换会自动开始,显示如下信息:

Loading database schema...

Loading data...
MT::Author
1

MT::Blog
1
3

MT::Trackback
...

Done copying data from Berkeley DB to your SQL database! All went well.

确认转换成功后,再修改mt-config.cgi,注释掉Berkeley DB的配置即可。

这里是官方的帮助文档:

 

Power editing basename

There's no way to batch edit basename in MT, even no a plugin for this.I hacked...

There's no way to batch edit basename in MT, even no a plugin for this.

I hacked into .tmpl and .pm files to implement the feature based on MT version 3.33.

  • \cgi-bin\mt\tmpl\cms\entry_table.tmpl

line 40 add:

<TMPL_IF NAME=IS_POWER_EDIT>
<th id="en-basename"><MT_TRANS phrase="Basename"></th>
</TMPL_IF>

line 133 add: 

<TMPL_IF NAME=IS_POWER_EDIT>
<td>
<input type="hidden" name="basename_manual_<TMPL_VAR NAME=ID>" id="basename_manual_<TMPL_VAR NAME=ID>" value="0" />
<input type="text" name="basename_<TMPL_VAR NAME=ID>" id="basename_<TMPL_VAR NAME=ID>" value="<TMPL_VAR NAME=BASENAME>" onchange="setElementValue('basename_<TMPL_VAR NAME=ID>', dirify(this.value));setElementValue('basename_manual_<TMPL_VAR NAME=ID>', 1)" />
</td>
</TMPL_IF>

 

  • \cgi-bin\mt\lib\MT\App\CMS.pm

line 6468 add:

        my $basename = $q->param('basename_' . $id);
if ( $basename && $q->param('basename_manual_' . $id)) {
$entry->basename($basename);
} elsif ( !$basename ) {
$entry->basename(MT::Util::make_unique_basename($entry));
}
  • \mt-static\style.css add(optional):

line 1107 add:

 #list-entry table #en-basename { width: 20% }

 

MT Upgrade from 3.2 to 3.33

Download MT 3.33 from MovableType.I didn't find the special version for upgrade,  however get it back...

Download MT 3.33 from MovableType.

I didn't find the special version for upgrade,  however get it back and unzip.

Out of my expectation, there's no any document about this release, like Readme.txt or so. Anyway I've experienced 2 times upgrade with past version.

Rename old cgi-bin directory as old, then upzip new as the original name. Make a compare by Beyond Compare, Rename mt-config.cgi-original to mt-config.cgi, and merge the old settings into it. The new configuration file remove most optional settings, only keep the required settings.

Modify the first line of all .cgi files from:

#!/usr/bin/perl -w

to

#!d:/green/perl/bin/perl -w

Rename old mt-static as mt-static_old, and move the new one to the path.

Open Firefox, address to http://blog.alex.com/cgi-bin/mt/mt.cgi, upgrade prompted automatically, Confirm to upgrade.

    * Upgrading database from version 3.2001.
    * Upgrading table for MT::Log
    * Upgrading table for MT::Category
    * Creating new template: 'Search Results Template'.
    * Assigning basename for categories... (100%)
    * Migrating any "tag" categories to new tags... (100%)
    * Setting new entry defaults for weblogs... (100%)
    * Updating user permissions for editing tags... (100%)
    * Database has been upgraded to version 3.3.

The new version works now.

Remain some work, need to restore the HTML Editor and some plugins from old version.

2006-11-20  Update

There're 3 plugins I used before update.

  • Collect
  • RelatedEntries
  • TinyMCE

Collect and RelatedEntries are easy to restore. TinyMce was intergreted via modifying tmpl files by myself more complex than a true plugin. I found there's new plugin comes,  EnhancedEntryEditing v1.11. TinyMCE v2.01 is wrapped in it. It' easy to install as well as normal plugins. See the online manual .

EnhancedEntryEditing provides less features as default setting than TinyMCE. I made change to support more features.

  1. Replace the content of below directory with the TinyMCE 2.02 to let it have the newest features.
    • EnhancedEntryEditing_1.11\EnhancedEntryEditing\mt-static\plugins\Ajaxify\tinymce
  2. Modify the plugin setting.

This step is more complex because of the version conflict. What I did is:

  • Comment out all settings from the EnhancedEntryEditing plugin(with TinyMCE 2.01)
  • Copy all settings from my old TinyMCE 2.02 as the current settings.
  • Merge the special settings in EnhancedEntryEditing to the current.
This is the last what I got.
ore,excerpt",
//theme : "advanced",
//plugins : "iespell, emotions, inlinepopups",
//theme_advanced_blockformats : "p,h1,h2,h3,h4,h5,h6",
//theme_advanced_buttons1 : "formatselect,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,undo,redo,separator,link,unlink,separator,image,emotions,iespell,help",
//theme_advanced_buttons2 : "",
//theme_advanced_buttons3 : "",
//theme_advanced_toolbar_location : "top",
//theme_advanced_toolbar_align : "left",
//extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],span[class|align|style]",
//force_p_newlines : true,
//relative_urls : false,
//remove_script_host : false,
//button_tile_map : true,
//ask : false,
//auto_cleanup_word : true,
//theme_advanced_path_location : "bottom",
//theme_advanced_resizing : true,
//theme_advanced_resize_horizontal : false,
//safari_warning: false,
//oninit: "quicktagsHide"

//mode : "textareas",
mode : "exact",
elements : "text,text_more",
//editor_selector : "mceEditor",
theme : "advanced",
//plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
plugins : "table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
//theme_advanced_buttons1_add_before : "save,separator",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_data/example_link_list.js",
external_image_list_url : "example_data/example_image_list.js",
flash_external_list_url : "example_data/example_flash_list.js",
content_css : "/css/screen.css",
force_p_newlines : true,
relative_urls : false,
remove_script_host : false,
button_tile_map : true,
ask : false,
auto_cleanup_word : true,
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false,
safari_warning: false,
oninit: "quicktagsHide"

FlickrPhotos Version 0.84

Added a new plugin to MT.

Flickr photos is a plugin that enables you to display thumbnail links of Flickr photos in your Movable Type blog. Flickr Photos focuses on displaying lists of photos, in many possible ways.

Export and Import with Basenames?

I losts my basenames for each entrie after I export and then import my entries from...

I losts my basenames for each entrie after I export and then import my entries from an old MT system to a fresh MT installation.

Export and Import don't deal with the field of Basenames for now.

To say the least, I also don't find the feture of Power Editing Basenames. 

I searched Six Part Plugin Directory, there's no any plugins that deal with either of my problems above.

Reference

replace all templates with another MT system ones

If you want to use all the templates of MT2 in MT1 including Indexes, Archives, System...

If you want to use all the templates of MT2 in MT1 including Indexes, Archives, System and Modules templates, you don't needs copying and pasting manually many times.

There's an easier way that just needs copying 10 files from MT1 to MT2 and rebuild the whole site. You will get all the templates from MT1 to MT2.

Here're the list of 10 files.

  1. template.db
  2. templatemap.db
  3. template.name.idx
  4. template.type.idx 
  5. template.blog_id.idx
  6. template.build_dynamic.idx
  7. templatemap.archive_type.idx
  8. templatemap.blog_id.idx
  9. templatemap.is_preferred.idx
  10. templatemap.template_id.idx

This operation depends that the 2 MT system have the same encode. Otherwise the double words will not be showed correctly.

trying to find a way of converting templates and posts from gb2312 to utf-8. here's a refer might help:

install TinyMCE into MT cms

Following code will make all tags of textareas editable with TinyMCE.Add following code to MT /tmpl/cms/header.tmpl<!--...

Following code will make all tags of textareas editable with TinyMCE.

Add following code to MT /tmpl/cms/header.tmpl

<!-- added by alex on 2006-02-12 -->
<script language="javascript" type="text/javascript" xsrc="/ref/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
    //mode : "textareas"
    mode : "exact",
    elements : "text,text_more",
    theme : "advanced",
    //plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
    plugins : "table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
    //theme_advanced_buttons1_add_before : "save,separator",
    theme_advanced_buttons1_add : "fontselect,fontsizeselect",
    theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
    theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
    theme_advanced_buttons3_add_before : "tablecontrols,separator",
    theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_location : "bottom",
    plugin_insertdate_dateFormat : "%Y-%m-%d",
    plugin_insertdate_timeFormat : "%H:%M:%S",
    extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
    external_link_list_url : "example_data/example_link_list.js",
    external_image_list_url : "example_data/example_image_list.js",
    flash_external_list_url : "example_data/example_flash_list.js"
    //content_css : "/styles-site.css"
});
</script>
<!-- added end -->

Edit /tmpl/cms/edit_entry.tmpl, to modify the value of the attribute ROWS for tag TEXTAREA which are defined as following id.

  • id="text"
  • id="text_more"

I don't want to the textareas of templates to be editable with TinyMCE, so I change code to following. 

/tmpl/cms/header.tmpl

<!-- added by alex on 2006-02-12
     modified by alex on 2006-03-01 -->
<script language="javascript" type="text/javascript" xsrc="/ref/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    //mode : "exact",
    //elements : "text,text_more",
    editor_selector : "mceEditor",
    theme : "advanced",
    //plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
    plugins : "table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
    //theme_advanced_buttons1_add_before : "save,separator",
    theme_advanced_buttons1_add : "fontselect,fontsizeselect",
    theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
    theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
    theme_advanced_buttons3_add_before : "tablecontrols,separator",
    theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_location : "bottom",
    plugin_insertdate_dateFormat : "%Y-%m-%d",
    plugin_insertdate_timeFormat : "%H:%M:%S",
    extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
    external_link_list_url : "example_data/example_link_list.js",
    external_image_list_url : "example_data/example_image_list.js",
    flash_external_list_url : "example_data/example_flash_list.js"
    content_css : "/css/screen.css"
});
</script>
<!-- added end -->

content_css : "/css/screen.css" tells TinyMCE to use my own css file to display the content of the editable TEXTAREA.

Edit /tmpl/cms/edit_entry.tmpl.

class="full-width mceEditor" name="text" id="text"
class="full-width mceEditor" name="text_more" id="text_more" 

MT 中控制Entries 的URL 名称

在Six apart 读到一篇文章,介绍了MT 3.2 版本支持的一项新功能:Entry basename control,在3.2 版本之前,MT不支持手动命名Entries 发布的URL ,是根据Title 自动生成的,如果是英文标题,会将其转化为小写,空格转化为下划线,并自动截断。如果是中文标题,则汉字部分被字母填充,类似于下面这样:mt_oeoeoeentrie.html在3.2 版本中提供了额外的Field 对URL 进行手动指定,这样的URL 就更友好。不过我一直使用3.14 版本,并通过变通的方法实现了URL手动命名。为此需要占用Entries...

Six apart 读到一篇文章,介绍了MT 3.2 版本支持的一项新功能:Entry basename control,在3.2 版本之前,MT不支持手动命名Entries 发布的URL ,是根据Title 自动生成的,如果是英文标题,会将其转化为小写,空格转化为下划线,并自动截断。如果是中文标题,则汉字部分被字母填充,类似于下面这样:

mt_oeoeoeentrie.html

在3.2 版本中提供了额外的Field 对URL 进行手动指定,这样的URL 就更友好。不过我一直使用3.14 版本,并通过变通的方法实现了URL手动命名。

为此需要占用Entries 编辑界面中的Extended Entry 项,并在Individual Archives 中进行设置。

WEBLOG CONFIG -> Archives Files -> Archives

选中Individual 的复选框,在Archives File Template 编辑框中设置:

<MTSubCategoryPath>/<MTIfNonEmpty tag="MTEntryMore"><$MTEntryMore dirify="1"$><MTElse><MTEntryDate format="%Y%m%d%H%M"></MTElse></MTIfNonEmpty>.html

<MTSubCategoryPath> 标签相当于:

<MTParentCategories glue="/"><MTCategoryLabel dirify="1"></MTParentCategories>

可将当前项所属所有父分类按层级,由"/" 进行连接,返回按文件路径规则格式化的字符串。

MTEntryMore 标签从Extended Entry 项中提取URL 命名,如果没有指定,则采用发布的日期命名URL 。

例如,我在本篇Entry 的Extended Entry 中指定:

mt entry basename control

则生成如下URL(本篇所属分类:Study Notes -> Web):

study_notes/web/mt_entry_basename_control.html
当然,如果你使用或者升级到3.2 版本,就不用费这么大的周折了.

安装MT Collect 插件,实现文章内自动索引标题