<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Weeeblog.net</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/" />
    <link rel="self" type="application/atom+xml" href="http://weeeblog.net/atom.xml" />
    <id>tag:weeeblog.net,2008-08-17://1</id>
    <updated>2008-08-20T09:19:29Z</updated>
    <subtitle>プログラマ okayama のウェッッッブログ</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.2-ja</generator>

<entry>
    <title>倉敷チボリ公園に行ってきました</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/08/18_2310.php" />
    <id>tag:weeeblog.net,2008://1.942</id>

    <published>2008-08-18T14:10:17Z</published>
    <updated>2008-08-20T09:19:29Z</updated>

    <summary>今、岡山にある実家に帰省中(寄生中?)なのだけれど、開園直後に行ってそれっきりに...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="life" label="Life" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="summervacation" label="Summer Vacation" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="tivolipark" label="Tivoli Park" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>今、岡山にある実家に帰省中(寄生中?)なのだけれど、開園直後に行ってそれっきりになっていた倉敷チボリ公園が今年いっぱいで閉園とかいうので、母親のリクエストもあって、10 年ぶりに行ってみました。次に帰るのはたぶん年末だけど、そのときはここで過ごすことはないだろうし。</p>

<p class="cSide"><img alt="チボリ公園:倉敷駅裏" src="/images/entry_tibolipark_00.jpg" height="200" width="267" /></p>

<p>んーなんだろうか。もうちょっと流行っているんだと思っていたけれど、閉園とか言われるだけあってやっぱり少し閑散とした印象があって、寂しかった。平日の月曜とはいえ、夏休みだし、もうちょっとファミリーとかカップルとかいてもいいんじゃないかと思うのだけれど。でも、連れて来てもらった子供たちは額に汗をかきながらはしゃぎ回っていて、それは、僕もパパになったらこんなとこに子供を連れてきてやろうかなと思うような、とても微笑ましい光景だった。</p>

<p>とりあえず母が目当てにしていた、流れる水の上をボートみたいな乗り物で走るアトラクションに乗る。乗ったことあるからいいよと断ってみたのだけれど、「三人でも乗れますよ」という係員に押されて渋々乗った。んーなつかしい。最後の落差のある滑り台よりも、最初の真っ暗な中で降りる滑り台の方が怖かった。気がついたらボートが GO 体勢になっていて、心の準備さえさせてもらえない。「お?おおおおおおお!?」とか言った。その後、お店でソフトクリームと「フリフリポテト(マクドナルドでいうシャカシャカポテト)」なるものを買ってみんなでつついた。梅かつお味がなかなかウマくて、ポテトに粉末かけて振るだけなんだけど、これはいつかどこかでまたお目にかかりたい。</p>

<p>開園直後に来たとき連れていたのは当時付き合っていた彼女で、それ以来僕は遊園地らしい場所に行った覚えがない。家族で遊園地に行ったということで考えれば 10 年ぶりではすまないだろうなあ、と年甲斐もなくはしゃぐ母親を見ながら考えていると、「あれ乗ろう」と二つ目の乗り物を彼女(母ね)が指定してきた。イスがチェーンでつり下がっていて、動き始めると遠心力でぐるんぐるん回されながらも高さが変わったりする、土地の狭さが反映されたチボリ公園の回転系アトラクションの中でも屈指の三半規管キラーなあいつだ(ちなみに、当時の僕はその前に乗ったコーヒーカップを彼女にぐるんぐるんに回されており、すでにグロッキー状態だったにも関わらずこいつに乗せられ、あえなくノックアウトされた)。さすがに丁重にお断りし、喫煙所でお疲れパパさんたちと一緒に一服して待つ。降りてきた母は真っ青でそれ以降乗り物には乗ろうとしなかったので、余ってしまったチケットは僕と妹で消化した。最後の観覧車でさえ乗ろうとしなかった。まあ、高校生の僕でもアウトだったのに、ぼちぼち年齢制限にも引っかかりそうな彼女ではなおさらだろう。</p>

<p class="rFloat"><img alt="チボリ公園:デンマークを模した町並" src="/images/entry_tibolipark_01.jpg" height="267" width="200" /></p>

<p>そのあと、土産物を売っているエリアに行ったのだけれど、ここがまた、かわいそうなくらい閑散としている。デンマークを模したテーマパークの中でも、町並みを再現した、最もデンマークなエリアにあるお店の中で売られているものは、トトロやヨーロッパ各国のお菓子や、デンマークと関係のない、岡山や倉敷のお土産品。いろいろ努力しても客足を伸ばせなかった痕跡が、ここがボトルネックであることを晒す結果になっていた。昔はもっと、チボリ公園行ったよ!的なお土産とか、涼しげなガラス工芸とかたくさんあって見るのも楽しかったことを考えれば、かつてはきっとボトルネックではなかったのだろうけれど、短絡的に売り上げを伸ばそうとした結果なんだろうと思うとちょっと寂しい。考え過ぎだといいなあ、と思いながら少し多めに買い物をした。仕事で来れなかった父親にビールと、大阪にもって帰るためのものをちらほら。母親はベンチでぐったりしていたが、このあと帰宅して、夕食に最高にうまいハンバーグを出したことには感服した。</p>

<p class="rFloat"><img alt="チボリ公園:ライトアップされた観覧車" src="/images/entry_tibolipark_02.jpg" height="267" width="200" /></p>

<p>最後に観覧車に乗って、残ったチケットを完全に消化してさあ帰るかというころに、ライトアップが始まった。チボリ公園は夜になると入園料が少し安くなって、ライトアップも楽しめる。むしろそこからが本番なのだけれど、あいにくとここは、夜が遅い町ではないので、その姿を知っている人はそんなに多くはないだろうな、と思う。でも、それはとてもキレイで、そういう愛されるべきところがちぐはぐしてしまって伸び悩んだのかなあ、と夕焼けの中で光り始めたライトを見ながら考える。</p>

<p>チボリ公園は、後発のテーマパークだけあって、非常に丁寧に作られている。細部までこだわりまくっている感じではなくても、バリアフリー設計やたくさんの植物、外装など、今でも限られた資源の中で、最大限の努力をしていることがうかがえる。スタッフの人選や教育もしっかりとなされている印象だった。暑かったけど楽しかった。クーラーかけて涼しくした実家で甲子園やオリンピックを見るより、ここに来てよかったと思った。できれば、なくさないでほしいなあ。</p>]]>
        
    </content>
</entry>

<entry>
    <title>Movable Type 4 へようこそ！</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/08/10_0020.php" />
    <id>tag:mtos.weeeblog.net,2008://1.1</id>

    <published>2008-08-09T15:20:14Z</published>
    <updated>2008-08-09T15:20:14Z</updated>

    <summary>このブログ記事は、Movable Type 4のインストール完了時に、システムに...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        このブログ記事は、Movable Type 4のインストール完了時に、システムによって自動的に作成されたブログ記事です。 新しくなったMT4の管理画面で、早速ブログを更新してみましょう。
        
    </content>
</entry>

<entry>
    <title>MTCS でも使える GoogleMap プラグイン(ストリートビュー対応版)</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/08/09_1827.php" />
    <id>tag:mtos.weeeblog.net,2008://1.671</id>

    <published>2008-08-09T09:27:33Z</published>
    <updated>2008-08-17T08:57:27Z</updated>

    <summary>先日の公開が話題を呼んでいる GoogleMapストリートビュー ですが、MTC...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="googlemap" label="GoogleMap" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="movabletype" label="Movable Type" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="plugins" label="Plugins" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="streetview" label="StreetView" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>先日の公開が話題を呼んでいる <a href="http://www.google.co.jp/help/maps/streetview/#utm_campaign=ja&utm_medium=ha&utm_source=ja-ha-apac-jp-bk-svn" target="_blank">GoogleMapストリートビュー</a> ですが、MTCS で使えたら面白いかもなあと思ってプラグインにしてみました。もちろん MTCS でなくてもちゃんと動作します。</p>

<h4 class="contentsSubTitle">概要</h4>

<p><abbr title="Movable Type">MT</abbr> の投稿画面および MTCS の投稿画面に、GoogleMap と GoogleMap ストリートビューを表示し、自動取得する座標を保存します。保存した座標は、ファンクションタグで取り出すことができます。</p>

<ul class="itemList01">
<li><a href="/images/img_plugins_googlemap01.jpg" target="_blank">管理画面からの投稿イメージ</a></li>
<li><a href="/images/img_plugins_googlemap02.jpg" target="_blank">MTCS での投稿イメージ</a></li>
<li><a href="http://googlemap.weeeblog.net/create-entry.html" target="_blank">こちらからテストを行うこともできます(アカウント: user、パスワード: password で、ロール「ユーザ」として投稿できます )</a></li>
</ul>

<h4 class="contentsSubTitle">動作環境</h4>

<p>現時点での最新版 MovableType 4.2rc5 で動作確認していますが、Movable Type 4 以降であれば動作すると思います。コミュニティ・パックでも使えます。</p>

<h4 class="contentsSubTitle">ダウンロード</h4>

<p><a href="/publish/mt/plugins/GoogleMap.zip" class="linkButton1">GoogleMap プラグイン(約 8.3 kb)</a></p>

<h4 class="contentsSubTitle">インストール</h4>

<p>解凍してできた GoogleMap/mt-static/plugins/GoogleMap フォルダを <abbr title="Movable Type">MT</abbr> の mt-static/plugins ディレクトリ内に、GoogleMap/plugins/GoogleMap フォルダを <abbr title="Movable Type">MT</abbr> の plugins ディレクトリ内に、それぞれそのままアップロードしてください。正しくアップロードできていれば、システム・メニューのプラグイン設定に GoogleMap プラグインが表示されます。</p>

<h4 class="contentsSubTitle">使い方</h4>

<p>まず、<a href="http://code.google.com/intl/ja/apis/maps/signup.html" target="_blank">こちら( Google Maps <abbr title="Application Programming Interface">API</abbr> 登録ページ )</a>から GoogleMap <abbr title="Application Programming Interface">API</abbr> Key を取得し、Movable Type 管理画面の、システム・メニューのプラグイン設定「Google Map <abbr title="Application Programming Interface">API</abbr> Key.」にそのままコピーしてください。ついでに、「GoogleMap を使用するブログ」で、GoogleMap を使用するブログを選択しておきます。「中心の座標」や「デフォルトのズームレベル」の項目は、ブログ記事を投稿する時の標準設定になります。必要に応じて変更してください。デフォルトでは東京タワーになっています。ここまで完了したら、「変更を保存」ボタンで保存します。これで、管理画面からのブログ記事投稿の際に、GoogleMap と ストリートビューが表示され、自動取得された座標がブログ記事の情報として保存されるようになります。</p>

<h4 class="contentsSubTitle">テンプレートのカスタマイズ</h4>

<p>次に、保存したデータを取り出せるようにテンプレートを変更します。まずはヘッダ部分に、GoogleMap を表示するための Javascript を埋め込みます。&lt;/head&gt; の直前あたりに、以下のように埋め込みます。</p>

<code>
<pre class="withScrl">
&lt;mt:IfBlog&gt;
&lt;mt:SetVarBlock name=&quot;googlemap_blog_id&quot;&gt;&lt;$mt:GoogleMapBlogID$&gt;&lt;/mt:SetVarBlock&gt;
&lt;mt:If name=&quot;blog_id&quot; eq=&quot;$googlemap_blog_id&quot;&gt;
&lt;script src=&quot;http://maps.google.co.jp/maps?file=api&amp;v=2&amp;key=&lt;$mt:GoogleMapApiKey$&gt;&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
//&lt;![CDATA[
&lt;mt:SetVarBlock name=&quot;center_lat&quot;&gt;&lt;mt:IfNonEmpty tag=&quot;EntryGoogleMapLat&quot;&gt;&lt;$mt:EntryGoogleMapLat$&gt;&lt;mt:else&gt;&lt;$mt:GooglemapCenterLat$&gt;&lt;/mt:IfNonEmpty&gt;&lt;/mt:SetVarBlock&gt;
&lt;mt:SetVarBlock name=&quot;center_lon&quot;&gt;&lt;mt:IfNonEmpty tag=&quot;EntryGoogleMapLon&quot;&gt;&lt;$mt:EntryGoogleMapLon$&gt;&lt;mt:else&gt;&lt;$mt:GooglemapCenterLon$&gt;&lt;/mt:IfNonEmpty&gt;&lt;/mt:SetVarBlock&gt;
var mapId = &quot;map&quot;;
var streetViewId = &quot;view&quot;;
var map;
var view;

// show map
function mapLoad () {
    if (GBrowserIsCompatible()) {
        map = new GMap2( document.getElementById( mapId ) );
        map.setCenter( new GLatLng( &lt;$mt:var name=&quot;center_lat&quot;$&gt;, &lt;$mt:var name=&quot;center_lon&quot;$&gt; ), &lt;$mt:googlemapdefaultlevel$&gt; );
        map.addControl( new GLargeMapControl() );
        
        // show cross
        var cross = document.createElement( &quot;div&quot; );
        var crossWidth = 23;	// cross width(img)
        var crossHeight = 23;	// cross height(img)
        var mapWidth = parseInt( map.getContainer().style.width );
        var mapHeight = parseInt( map.getContainer().style.height );
        var x = ( mapWidth - crossWidth ) / 2;	// cross center(x)
        var y = ( mapHeight - crossHeight ) / 2;  // cross center(y)
        cross.style.position = &quot;absolute&quot;;
        cross.style.top = y+&quot;px&quot;;
        cross.style.left = x+&quot;px&quot;;
        cross.style.backgroundImage = &quot;url( &lt;$mt:staticwebpath$&gt;plugins/GoogleMap/center.gif )&quot;;
        cross.style.width = crossWidth+&quot;px&quot;;
        cross.style.height = crossHeight+&quot;px&quot;;
        cross.style.opacity = 0.5;
        map.getContainer().appendChild(cross);
        viewLoad( &lt;$mt:var name=&quot;center_lat&quot;$&gt;, &lt;$mt:var name=&quot;center_lon&quot;$&gt; );
        
        // event listener
        GEvent.addListener( map, 'click', mapClickEvent );
        GEvent.addListener( map, 'move', mapMoveEvent );
    }
}

// show street view
function viewLoad() {
    targetPoint  = new GLatLng( &lt;$mt:var name=&quot;center_lat&quot;$&gt;, &lt;$mt:var name=&quot;center_lon&quot;$&gt; );
    panoramaOptions  = { latlng:targetPoint };
    view = new GStreetviewPanorama( document.getElementById( streetViewId ), panoramaOptions );
        
    // event listener
    GEvent.addListener( view, &quot;error&quot;, handlePanoramaError );
    GEvent.addListener( view, &quot;initialized&quot;, handleViewInitialized );
}

// map event
function mapInit( lat, lon ) {
    if ( ! lat ) {
        lat = &lt;$mt:var name=&quot;center_lat&quot;$&gt;;
    }
    if ( ! lon ) {
        lon = &lt;$mt:var name=&quot;center_lon&quot;$&gt;;
    }
    map.setCenter( lat, lon );
}

function mapMoveEvent() {
    var xy = map.getCenter();
    if ( document.getElementById( &quot;lat&quot; ) ) {
        document.getElementById( &quot;lat&quot; ).value = xy.lat();
    }
    if ( document.getElementById( &quot;lon&quot; ) ) {
        document.getElementById( &quot;lon&quot; ).value = xy.lng();
    }
    viewInit( xy.lat(), xy.lng() );
}

function mapClickEvent( overlay, point ){
    map.setCenter( point );
    view.setLocationAndPOV( point );
}

// street view event
function viewInit( lat, lon ) {
    if ( ! lat ) {
        lat = &lt;$mt:var name=&quot;center_lat&quot;$&gt;;
    }
    if ( ! lon ) {
        lon = &lt;$mt:var name=&quot;center_lon&quot;$&gt;;
    }
    targetPoint  = new GLatLng( lat, lon );
    view.setLocationAndPOV( targetPoint );
}

function handleViewInitialized( location ) {
    map.setCenter(location.latlng);
}
    
function handlePanoramaError( errorCode ) {
  if ( errorCode == 600 ) {
    document.getElementById( streetViewId ).innerHTML = '&lt;p style=&quot;color:red;&quot;&gt;You cannot use street view in this area.&lt;/p&gt;';
    return;
  }
  if ( errorCode == FLASH_UNAVAILABLE ) {
    document.getElementById( streetViewId ).innerHTML = '&lt;p style=&quot;color:red;&quot;&gt;You cannnot use streew view by this browser.&lt;/p&gt;';
    return;
  }
}
//]]&gt;
&lt;/script&gt;
&lt;/mt:If&gt;
&lt;/mt:IfBlog&gt;
</pre>
</code>

<p>さらに、画面の読み込み時に GoogleMap が表示されるように、body タグに以下の属性を埋め込みます。</p>

<code>
<pre>
onload="javascript:mapLoad();" onUnload="javascript:GUnload()"
</pre>
</code>

<p>デフォルトの MTCS の場合、グローバルテンプレートの「ヘッダー」テンプレートは以下のようになっているので、</p>

<code>
<pre class="withScrl">
&lt;mt:SetVarBlock name=&quot;html_head&quot; prepend=&quot;1&quot;&gt;

    &lt;mt:IfBlog&gt;
        &lt;mt:Ignore&gt;
    &lt;!-- Community Solution Blog variables --&gt;
    &lt;!-- The below variables are used when there a blog is in context.  --&gt;
        &lt;/mt:Ignore&gt;
        &lt;mt:SetVarBlock name=&quot;blog_id&quot;&gt;&lt;$mt:BlogID$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_name&quot;&gt;&lt;$mt:BlogName encode_html=&quot;1&quot;$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_description&quot;&gt;&lt;$mt:BlogDescription$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_url&quot;&gt;&lt;$mt:BlogURL$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;profile_view_url&quot;&gt;&lt;$mt:CGIPath$&gt;&lt;$mt:CommunityScript$&gt;?__mode=view&amp;amp;blog_id=&lt;$mt:BlogID$&gt;&amp;amp;id=&lt;/mt:SetVarBlock&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;$mt:Link template=&quot;styles&quot;$&gt;&quot; type=&quot;text/css&quot; /&gt;
        &lt;link rel=&quot;alternate&quot; type=&quot;application/atom+xml&quot; title=&quot;Atom&quot; href=&quot;&lt;$mt:Link template=&quot;feed_recent&quot;$&gt;&quot; /&gt;
        &lt;link rel=&quot;start&quot; href=&quot;&lt;$mt:BlogURL$&gt;&quot; title=&quot;Home&quot; /&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;&lt;$mt:Link template=&quot;javascript&quot;$&gt;&quot;&gt;&lt;/script&gt;
        &lt;$mt:CCLicenseRDF$&gt;
    &lt;mt:Else&gt;
        &lt;mt:Ignore&gt;
    &lt;!-- Community Solution Static variables --&gt;
    &lt;!-- The below variables are used when there is no blog in context. Set them to defaults in the case that they are used w/o a blog context --&gt;
        &lt;/mt:Ignore&gt;
        &lt;mt:SetVarBlock name=&quot;blog_name&quot;&gt;ブログ名&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_description&quot;&gt;ブログの説明&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_url&quot;&gt;#&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;profile_view_url&quot;&gt;&lt;$mt:CGIPath$&gt;&lt;$mt:CommunityScript$&gt;?__mode=view&amp;amp;blog_id=&lt;$mt:BlogID$&gt;&amp;amp;id=&lt;/mt:SetVarBlock&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;$mt:StaticWebPath$&gt;themes-base/blog.css&quot; type=&quot;text/css&quot; /&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;$mt:StaticWebPath$&gt;themes-base/forum.css&quot; type=&quot;text/css&quot; /&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;$mt:StaticWebPath$&gt;themes/tristan-blue-4.2/screen.css&quot; type=&quot;text/css&quot; /&gt;
        &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;$mt:Include module=&quot;GlobalJavaScript&quot;$&gt;&lt;/script&gt;
        &lt;!-- END Community Solution Styles --&gt;
    &lt;/mt:IfBlog&gt;

&lt;/mt:SetVarBlock&gt;

&lt;mt:If tag=&quot;BlogTemplateSetID&quot; eq=&quot;mt-community-forum&quot;&gt;&lt;$mt:Var name=&quot;page_layout&quot; value=&quot;layout-wm&quot;$&gt;&lt;/mt:If&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//<abbr title="World Wide Web Consortium">W3C</abbr>//<abbr title="Document Type Definition">DTD</abbr> <abbr title="Extensible HyperText Markup Language">XHTML</abbr> 1.0 Transitional//EN&quot;
    &quot;http://www.w3.org/TR/xhtml1/<abbr title="Document Type Definition">DTD</abbr>/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;&lt;$mt:BlogLanguage$&gt;&quot; lang=&quot;&lt;$mt:BlogLanguage$&gt;&quot; id=&quot;sixapart-standard&quot;&gt;
&lt;head&gt;
    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=&lt;$mt:PublishCharset$&gt;&quot; /&gt;
    &lt;meta http-equiv=&quot;Content-Style-Type&quot; content=&quot;text/css&quot; /&gt;
    &lt;meta http-equiv=&quot;Content-Script-Type&quot; content=&quot;text/javascript&quot; /&gt;
    &lt;meta http-equiv=&quot;imagetoolbar&quot; content=&quot;no&quot; /&gt;    
    &lt;title&gt;&lt;$mt:Var name=&quot;title&quot;$&gt;&lt;/title&gt;
    &lt;meta name=&quot;generator&quot; content=&quot;&lt;$mt:ProductName version=&quot;1&quot;$&gt;&quot; /&gt;
    &lt;$mt:Var name=&quot;html_head&quot;$&gt;
    &lt;mt:Ignore&gt;
    &lt;!-- Community Solution Scoring --&gt;
    &lt;!-- This updates any scoring controls on the page for the user who is signed-in. --&gt;
    &lt;/mt:Ignore&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    /* &lt;![CDATA[ */
    mtAttachEvent('load', mtUpdateScores);
    mtAttachEvent('usersignin', mtUpdateScores);
    /* ]]&gt; */
    &lt;/script&gt;
&lt;/head&gt;
&lt;body id=&quot;&lt;$mt:BlogTemplateSetID$&gt;&quot; class=&quot;&lt;$mt:Var name=&quot;body_class&quot;$&gt; &lt;$mt:Var name=&quot;page_layout&quot;$&gt;&quot;&gt;
    &lt;div id=&quot;container&quot;&gt;
        &lt;div id=&quot;container-inner&quot;&gt;
            &lt;div id=&quot;header&quot;&gt;
                &lt;div id=&quot;header-inner&quot;&gt;
                    &lt;div id=&quot;header-content&quot;&gt;
&lt;mt:If name=&quot;main_index&quot;&gt;
                        &lt;h1 id=&quot;header-name&quot;&gt;&lt;a href=&quot;&lt;$mt:Var name=&quot;blog_url&quot;$&gt;&quot; accesskey=&quot;1&quot;&gt;&lt;$mt:Var name=&quot;blog_name&quot;$&gt;&lt;/a&gt;&lt;/h1&gt;
    &lt;mt:If name=&quot;blog_description&quot;&gt;
                        &lt;h2 id=&quot;header-description&quot;&gt;&lt;$mt:Var name=&quot;blog_description&quot;$&gt;&lt;/h2&gt;
    &lt;/mt:If&gt;
&lt;mt:Else&gt;
                        &lt;div id=&quot;header-name&quot;&gt;&lt;a href=&quot;&lt;$mt:Var name=&quot;blog_url&quot;$&gt;&quot; accesskey=&quot;1&quot;&gt;&lt;$mt:Var name=&quot;blog_name&quot;$&gt;&lt;/a&gt;&lt;/div&gt;
    &lt;mt:If name=&quot;blog_description&quot;&gt;
                        &lt;div id=&quot;header-description&quot;&gt;&lt;$mt:Var name=&quot;blog_description&quot;$&gt;&lt;/div&gt;
    &lt;/mt:If&gt;
&lt;/mt:If&gt;
                        &lt;$mt:Include module=&quot;ナビゲーション&quot;$&gt;
                        &lt;$mt:Include module=&quot;サインイン&quot;$&gt;
                        &lt;$mt:Include module=&quot;検索&quot;$&gt;
                   &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div id=&quot;content&quot;&gt;
                &lt;div id=&quot;content-inner&quot;&gt;
                    &lt;div id=&quot;alpha&quot;&gt;
                        &lt;div id=&quot;alpha-inner&quot;&gt;
</pre>
</code>

<p>これを、以下のように変更するとよいでしょう。</p>

<code>
<pre class="withScrl">
&lt;mt:SetVarBlock name=&quot;html_head&quot; prepend=&quot;1&quot;&gt;

    &lt;mt:IfBlog&gt;
        &lt;mt:Ignore&gt;
    &lt;!-- Community Solution Blog variables --&gt;
    &lt;!-- The below variables are used when there a blog is in context.  --&gt;
        &lt;/mt:Ignore&gt;
        &lt;mt:SetVarBlock name=&quot;blog_id&quot;&gt;&lt;$mt:BlogID$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_name&quot;&gt;&lt;$mt:BlogName encode_html=&quot;1&quot;$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_description&quot;&gt;&lt;$mt:BlogDescription$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_url&quot;&gt;&lt;$mt:BlogURL$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;profile_view_url&quot;&gt;&lt;$mt:CGIPath$&gt;&lt;$mt:CommunityScript$&gt;?__mode=view&amp;amp;blog_id=&lt;$mt:BlogID$&gt;&amp;amp;id=&lt;/mt:SetVarBlock&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;$mt:Link template=&quot;styles&quot;$&gt;&quot; type=&quot;text/css&quot; /&gt;
        &lt;link rel=&quot;alternate&quot; type=&quot;application/atom+xml&quot; title=&quot;Atom&quot; href=&quot;&lt;$mt:Link template=&quot;feed_recent&quot;$&gt;&quot; /&gt;
        &lt;link rel=&quot;start&quot; href=&quot;&lt;$mt:BlogURL$&gt;&quot; title=&quot;Home&quot; /&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;&lt;$mt:Link template=&quot;javascript&quot;$&gt;&quot;&gt;&lt;/script&gt;
        &lt;$mt:CCLicenseRDF$&gt;
    &lt;mt:Else&gt;
        &lt;mt:Ignore&gt;
    &lt;!-- Community Solution Static variables --&gt;
    &lt;!-- The below variables are used when there is no blog in context. Set them to defaults in the case that they are used w/o a blog context --&gt;
        &lt;/mt:Ignore&gt;
        &lt;mt:SetVarBlock name=&quot;blog_name&quot;&gt;ブログ名&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_description&quot;&gt;ブログの説明&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;blog_url&quot;&gt;#&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;profile_view_url&quot;&gt;&lt;$mt:CGIPath$&gt;&lt;$mt:CommunityScript$&gt;?__mode=view&amp;amp;blog_id=&lt;$mt:BlogID$&gt;&amp;amp;id=&lt;/mt:SetVarBlock&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;$mt:StaticWebPath$&gt;themes-base/blog.css&quot; type=&quot;text/css&quot; /&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;$mt:StaticWebPath$&gt;themes-base/forum.css&quot; type=&quot;text/css&quot; /&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;$mt:StaticWebPath$&gt;themes/tristan-blue-4.2/screen.css&quot; type=&quot;text/css&quot; /&gt;
        &lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;$mt:Include module=&quot;GlobalJavaScript&quot;$&gt;&lt;/script&gt;
        &lt;!-- END Community Solution Styles --&gt;
    &lt;/mt:IfBlog&gt;

&lt;/mt:SetVarBlock&gt;

&lt;mt:If tag=&quot;BlogTemplateSetID&quot; eq=&quot;mt-community-forum&quot;&gt;&lt;$mt:Var name=&quot;page_layout&quot; value=&quot;layout-wm&quot;$&gt;&lt;/mt:If&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//<abbr title="World Wide Web Consortium">W3C</abbr>//<abbr title="Document Type Definition">DTD</abbr> <abbr title="Extensible HyperText Markup Language">XHTML</abbr> 1.0 Transitional//EN&quot;
    &quot;http://www.w3.org/TR/xhtml1/<abbr title="Document Type Definition">DTD</abbr>/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;&lt;$mt:BlogLanguage$&gt;&quot; lang=&quot;&lt;$mt:BlogLanguage$&gt;&quot; id=&quot;sixapart-standard&quot;&gt;
&lt;head&gt;
    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=&lt;$mt:PublishCharset$&gt;&quot; /&gt;
    &lt;meta http-equiv=&quot;Content-Style-Type&quot; content=&quot;text/css&quot; /&gt;
    &lt;meta http-equiv=&quot;Content-Script-Type&quot; content=&quot;text/javascript&quot; /&gt;
    &lt;meta http-equiv=&quot;imagetoolbar&quot; content=&quot;no&quot; /&gt;    
    &lt;title&gt;&lt;$mt:Var name=&quot;title&quot;$&gt;&lt;/title&gt;
    &lt;meta name=&quot;generator&quot; content=&quot;&lt;$mt:ProductName version=&quot;1&quot;$&gt;&quot; /&gt;
    &lt;$mt:Var name=&quot;html_head&quot;$&gt;
    &lt;mt:Ignore&gt;
    &lt;!-- Community Solution Scoring --&gt;
    &lt;!-- This updates any scoring controls on the page for the user who is signed-in. --&gt;
    &lt;/mt:Ignore&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
    /* &lt;![CDATA[ */
    mtAttachEvent('load', mtUpdateScores);
    mtAttachEvent('usersignin', mtUpdateScores);
    /* ]]&gt; */
    &lt;/script&gt;
&lt;mt:IfBlog&gt;
&lt;mt:SetVarBlock name=&quot;googlemap_blog_id&quot;&gt;&lt;$mt:GoogleMapBlogID$&gt;&lt;/mt:SetVarBlock&gt;
&lt;mt:If name=&quot;blog_id&quot; eq=&quot;$googlemap_blog_id&quot;&gt;
&lt;script src=&quot;http://maps.google.co.jp/maps?file=api&amp;v=2&amp;key=&lt;$mt:GoogleMapApiKey$&gt;&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
//&lt;![CDATA[
&lt;mt:SetVarBlock name=&quot;center_lat&quot;&gt;&lt;mt:IfNonEmpty tag=&quot;EntryGoogleMapLat&quot;&gt;&lt;$mt:EntryGoogleMapLat$&gt;&lt;mt:else&gt;&lt;$mt:GooglemapCenterLat$&gt;&lt;/mt:IfNonEmpty&gt;&lt;/mt:SetVarBlock&gt;
&lt;mt:SetVarBlock name=&quot;center_lon&quot;&gt;&lt;mt:IfNonEmpty tag=&quot;EntryGoogleMapLon&quot;&gt;&lt;$mt:EntryGoogleMapLon$&gt;&lt;mt:else&gt;&lt;$mt:GooglemapCenterLon$&gt;&lt;/mt:IfNonEmpty&gt;&lt;/mt:SetVarBlock&gt;
var mapId = &quot;map&quot;;
var streetViewId = &quot;view&quot;;
var map;
var view;

// show map
function mapLoad () {
    if (GBrowserIsCompatible()) {
        map = new GMap2( document.getElementById( mapId ) );
        map.setCenter( new GLatLng( &lt;$mt:var name=&quot;center_lat&quot;$&gt;, &lt;$mt:var name=&quot;center_lon&quot;$&gt; ), &lt;$mt:googlemapdefaultlevel$&gt; );
        map.addControl( new GLargeMapControl() );
        
        // show cross
        var cross = document.createElement( &quot;div&quot; );
        var crossWidth = 23;	// cross width(img)
        var crossHeight = 23;	// cross height(img)
        var mapWidth = parseInt( map.getContainer().style.width );
        var mapHeight = parseInt( map.getContainer().style.height );
        var x = ( mapWidth - crossWidth ) / 2;	// cross center(x)
        var y = ( mapHeight - crossHeight ) / 2;  // cross center(y)
        cross.style.position = &quot;absolute&quot;;
        cross.style.top = y+&quot;px&quot;;
        cross.style.left = x+&quot;px&quot;;
        cross.style.backgroundImage = &quot;url( &lt;$mt:staticwebpath$&gt;plugins/GoogleMap/center.gif )&quot;;
        cross.style.width = crossWidth+&quot;px&quot;;
        cross.style.height = crossHeight+&quot;px&quot;;
        cross.style.opacity = 0.5;
        map.getContainer().appendChild(cross);
        viewLoad( &lt;$mt:var name=&quot;center_lat&quot;$&gt;, &lt;$mt:var name=&quot;center_lon&quot;$&gt; );
        
        // event listener
        GEvent.addListener( map, 'click', mapClickEvent );
        GEvent.addListener( map, 'move', mapMoveEvent );
    }
}

// show street view
function viewLoad() {
    targetPoint  = new GLatLng( &lt;$mt:var name=&quot;center_lat&quot;$&gt;, &lt;$mt:var name=&quot;center_lon&quot;$&gt; );
    panoramaOptions  = { latlng:targetPoint };
    view = new GStreetviewPanorama( document.getElementById( streetViewId ), panoramaOptions );
        
    // event listener
    GEvent.addListener( view, &quot;error&quot;, handlePanoramaError );
    GEvent.addListener( view, &quot;initialized&quot;, handleViewInitialized );
}

// map event
function mapInit( lat, lon ) {
    if ( ! lat ) {
        lat = &lt;$mt:var name=&quot;center_lat&quot;$&gt;;
    }
    if ( ! lon ) {
        lon = &lt;$mt:var name=&quot;center_lon&quot;$&gt;;
    }
    map.setCenter( lat, lon );
}

function mapMoveEvent() {
    var xy = map.getCenter();
    if ( document.getElementById( &quot;lat&quot; ) ) {
        document.getElementById( &quot;lat&quot; ).value = xy.lat();
    }
    if ( document.getElementById( &quot;lon&quot; ) ) {
        document.getElementById( &quot;lon&quot; ).value = xy.lng();
    }
    viewInit( xy.lat(), xy.lng() );
}

function mapClickEvent( overlay, point ){
    map.setCenter( point );
    view.setLocationAndPOV( point );
}

// street view event
function viewInit( lat, lon ) {
    if ( ! lat ) {
        lat = &lt;$mt:var name=&quot;center_lat&quot;$&gt;;
    }
    if ( ! lon ) {
        lon = &lt;$mt:var name=&quot;center_lon&quot;$&gt;;
    }
    targetPoint  = new GLatLng( lat, lon );
    view.setLocationAndPOV( targetPoint );
}

function handleViewInitialized( location ) {
    map.setCenter(location.latlng);
}
    
function handlePanoramaError( errorCode ) {
  if ( errorCode == 600 ) {
    document.getElementById( streetViewId ).innerHTML = '&lt;p style=&quot;color:red;&quot;&gt;You cannot use street view in this area.&lt;/p&gt;';
    return;
  }
  if ( errorCode == FLASH_UNAVAILABLE ) {
    document.getElementById( streetViewId ).innerHTML = '&lt;p style=&quot;color:red;&quot;&gt;You cannnot use streew view by this browser.&lt;/p&gt;';
    return;
  }
}
//]]&gt;
&lt;/script&gt;
&lt;/mt:If&gt;
&lt;/mt:IfBlog&gt;
&lt;/head&gt;
&lt;mt:If name=&quot;blog_id&quot; eq=&quot;$googlemap_blog_id&quot;&gt;
&lt;body onload=&quot;javascript:mapLoad();&quot; onUnload=&quot;javascript:GUnload()&quot; id=&quot;&lt;$mt:BlogTemplateSetID$&gt;&quot; class=&quot;&lt;$mt:Var name=&quot;body_class&quot;$&gt; &lt;$mt:Var name=&quot;page_layout&quot;$&gt;&quot;&gt;
&lt;mt:else&gt;
&lt;body id=&quot;&lt;$mt:BlogTemplateSetID$&gt;&quot; class=&quot;&lt;$mt:Var name=&quot;body_class&quot;$&gt; &lt;$mt:Var name=&quot;page_layout&quot;$&gt;&quot;&gt;
&lt;/mt:If&gt;
    &lt;div id=&quot;container&quot;&gt;
        &lt;div id=&quot;container-inner&quot;&gt;
            &lt;div id=&quot;header&quot;&gt;
                &lt;div id=&quot;header-inner&quot;&gt;
                    &lt;div id=&quot;header-content&quot;&gt;
&lt;mt:If name=&quot;main_index&quot;&gt;
                        &lt;h1 id=&quot;header-name&quot;&gt;&lt;a href=&quot;&lt;$mt:Var name=&quot;blog_url&quot;$&gt;&quot; accesskey=&quot;1&quot;&gt;&lt;$mt:Var name=&quot;blog_name&quot;$&gt;&lt;/a&gt;&lt;/h1&gt;
    &lt;mt:If name=&quot;blog_description&quot;&gt;
                        &lt;h2 id=&quot;header-description&quot;&gt;&lt;$mt:Var name=&quot;blog_description&quot;$&gt;&lt;/h2&gt;
    &lt;/mt:If&gt;
&lt;mt:Else&gt;
                        &lt;div id=&quot;header-name&quot;&gt;&lt;a href=&quot;&lt;$mt:Var name=&quot;blog_url&quot;$&gt;&quot; accesskey=&quot;1&quot;&gt;&lt;$mt:Var name=&quot;blog_name&quot;$&gt;&lt;/a&gt;&lt;/div&gt;
    &lt;mt:If name=&quot;blog_description&quot;&gt;
                        &lt;div id=&quot;header-description&quot;&gt;&lt;$mt:Var name=&quot;blog_description&quot;$&gt;&lt;/div&gt;
    &lt;/mt:If&gt;
&lt;/mt:If&gt;
                        &lt;$mt:Include module=&quot;ナビゲーション&quot;$&gt;
                        &lt;$mt:Include module=&quot;サインイン&quot;$&gt;
                        &lt;$mt:Include module=&quot;検索&quot;$&gt;
                   &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div id=&quot;content&quot;&gt;
                &lt;div id=&quot;content-inner&quot;&gt;
                    &lt;div id=&quot;alpha&quot;&gt;
                        &lt;div id=&quot;alpha-inner&quot;&gt;
</pre>
</code>

<p>次に、テンプレートモジュール「ブログ記事の詳細」または、ブログ記事が表示される箇所に、</p>

<code>
<pre>
&lt;div id=&quot;map&quot; style=&quot;width: 500px; height: 350px; border: 1px solid #ccc; margin-bottom: 20px;&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;view&quot; style=&quot;width: 500px; height: 350px; border: 1px solid #ccc; margin-bottom: 20px;&quot;&gt;&lt;/div&gt;
</pre>
</code>

<p>を埋め込みます。MTCS デフォルトの場合、「ブログ記事の詳細」は以下のようになっているので、</p>

<code>
<pre class="withScrl">
&lt;div id=&quot;entry-&lt;$mt:EntryID$&gt;&quot; class=&quot;entry-asset asset hentry&quot;&gt;
    &lt;div class=&quot;asset-header&quot;&gt;
        &lt;h1 id=&quot;page-title&quot; class=&quot;asset-name entry-title&quot;&gt;&lt;$mt:EntryTitle$&gt;&lt;/h1&gt;
        &lt;$mt:Include module=&quot;ブログ記事のメタデータ&quot;$&gt;
    &lt;/div&gt;
    &lt;div class=&quot;asset-content entry-content&quot;&gt;
&lt;mt:If tag=&quot;EntryBody&quot;&gt;
        &lt;div class=&quot;asset-body&quot;&gt;
            &lt;$mt:EntryBody$&gt;
        &lt;/div&gt;
&lt;/mt:If&gt;
&lt;mt:If tag=&quot;EntryMore&quot; convert_breaks=&quot;0&quot;&gt;
        &lt;div id=&quot;more&quot; class=&quot;asset-more&quot;&gt;
            &lt;$mt:EntryMore$&gt;
        &lt;/div&gt;
&lt;/mt:If&gt;
&lt;mt:EntryCustomFields&gt;
    &lt;$mt:CustomFieldValue$&gt;
&lt;/mt:EntryCustomFields&gt;
    &lt;/div&gt;
    &lt;div class=&quot;asset-footer&quot;&gt;
        &lt;$mt:Include module=&quot;カテゴリ&quot;$&gt;
        &lt;$mt:Include module=&quot;タグ&quot;$&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre>
</code>

<p>本文のすぐ下に表示したい場合、以下のようにするとよいでしょう。</p>

<code>
<pre class="withScrl">
&lt;div id=&quot;entry-&lt;$mt:EntryID$&gt;&quot; class=&quot;entry-asset asset hentry&quot;&gt;
    &lt;div class=&quot;asset-header&quot;&gt;
        &lt;h1 id=&quot;page-title&quot; class=&quot;asset-name entry-title&quot;&gt;&lt;$mt:EntryTitle$&gt;&lt;/h1&gt;
        &lt;$mt:Include module=&quot;ブログ記事のメタデータ&quot;$&gt;
    &lt;/div&gt;
    &lt;div class=&quot;asset-content entry-content&quot;&gt;
&lt;mt:If tag=&quot;EntryBody&quot;&gt;
        &lt;div class=&quot;asset-body&quot;&gt;
            &lt;$mt:EntryBody$&gt;
        &lt;/div&gt;
&lt;/mt:If&gt;
&lt;mt:Ignore&gt;&lt;!--[GoogleMap]--&gt;&lt;/mt:Ignore&gt;
&lt;div id=&quot;map&quot; style=&quot;width: 500px; height: 350px; border: 1px solid #ccc; margin-bottom: 20px;&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;view&quot; style=&quot;width: 500px; height: 350px; border: 1px solid #ccc; margin-bottom: 20px;&quot;&gt;&lt;/div&gt;
&lt;mt:Ignore&gt;&lt;!--/[GoogleMap]--&gt;&lt;/mt:Ignore&gt;
&lt;mt:If tag=&quot;EntryMore&quot; convert_breaks=&quot;0&quot;&gt;
        &lt;div id=&quot;more&quot; class=&quot;asset-more&quot;&gt;
            &lt;$mt:EntryMore$&gt;
        &lt;/div&gt;
&lt;/mt:If&gt;
&lt;mt:EntryCustomFields&gt;
    &lt;$mt:CustomFieldValue$&gt;
&lt;/mt:EntryCustomFields&gt;
    &lt;/div&gt;
    &lt;div class=&quot;asset-footer&quot;&gt;
        &lt;$mt:Include module=&quot;カテゴリ&quot;$&gt;
        &lt;$mt:Include module=&quot;タグ&quot;$&gt;
    &lt;/div&gt;
&lt;/div&gt;
</pre>
</code>

<p>これで、投稿の際に設定した GoogleMap およびストリートビューが表示されるようになります。</p>

<h4 class="contentsSubTitle">MTCS で投稿する画面のカスタマイズ</h4>

<p>MTCS の投稿画面で GoogleMap の座標を設定できるようにするには、投稿フォームのカスタマイズが必要です。デフォルト状態の投稿フォームは、テンプレートモジュール「ブログ記事フォーム」です。このテンプレートは、以下のようになっているので、</p>

<code>
<pre class="withScrl">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
function entry_create_loggedin() {
    var u = mtGetUser();
    var loggedin = u &amp;&amp; u.is_authenticated &amp;&amp; u.is_author ? true : false;
    var eid = 'logged_in';
    conditional_block(loggedin, eid);
    if (!loggedin) {
        var p = document.getElementById('login_message');
        if (!p) return;
        if (u &amp;&amp; !u.is_author) 
            p.innerHTML = &quot;ブログに投稿する前に登録を行ってください。&quot;;
        else
            if (u &amp;&amp; !u.can_post)
                p.innerHTML = &quot;投稿する権限がありません。&quot;;
            else
                p.innerHTML = '&lt;a href=&quot;javascript:void(0)&quot; onclick=&quot;return mtSignInOnClick(\'login_message\')&quot;&gt;サインインしてブログ記事を投稿してください。&lt;/a&gt;';
    } else {
        var mt = document.getElementById('magic_token');
        if (mt) mt.value = u.sid;
    }
}
// --&gt;
&lt;/script&gt;
&lt;mt:IfLoggedIn script=&quot;entry_create_loggedin&quot;&gt;
&lt;form method=&quot;post&quot; action=&quot;&lt;$mt:CGIPath$&gt;&lt;$mt:CommunityScript$&gt;&quot; name=&quot;entry_form&quot; id=&quot;create-entry-form&quot; enctype=&quot;multipart/form-data&quot;&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;__mode&quot; value=&quot;post&quot; /&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;blog_id&quot; value=&quot;&lt;$mt:BlogID$&gt;&quot; /&gt;
    &lt;input type=&quot;hidden&quot; id=&quot;magic_token&quot; name=&quot;magic_token&quot; value=&quot;&quot; /&gt;
    &lt;mt:SetVarBlock name=&quot;field-content&quot;&gt;&lt;input id=&quot;entry-title&quot; class=&quot;ti&quot; name=&quot;title&quot; /&gt;&lt;/mt:SetVarBlock&gt;
    &lt;$mt:Include module=&quot;フォームフィールド&quot; id=&quot;entry-title&quot; class=&quot;&quot; label=&quot;タイトル&quot;$&gt;

    &lt;mt:SetVarBlock name=&quot;field-content&quot;&gt;&lt;textarea id=&quot;entry-body&quot; class=&quot;ta&quot; name=&quot;text&quot; rows=&quot;15&quot; cols=&quot;50&quot;&gt;&lt;/textarea&gt;&lt;/mt:SetVarBlock&gt;
    &lt;$mt:Include module=&quot;フォームフィールド&quot; id=&quot;entry-body&quot; class=&quot;&quot; label=&quot;本文&quot;$&gt;

    &lt;mt:If tag=&quot;BlogCategoryCount&quot;&gt;
        &lt;mt:SetVarBlock name=&quot;field-content&quot;&gt;
            &lt;select id=&quot;entry-category&quot; name=&quot;category&quot;&gt;
                &lt;option value=&quot;0&quot;&gt;カテゴリを選択...&lt;/option&gt;
            &lt;mt:TopLevelCategories&gt;
                &lt;mt:SetVarBlock name=&quot;loop_to&quot;&gt;&lt;$mt:Var name=&quot;__depth__&quot; _default=&quot;0&quot;$&gt;&lt;/mt:SetVarBlock&gt;&lt;mt:SetVarBlock name=&quot;spacer&quot;&gt;&lt;mt:For start=&quot;1&quot; end=&quot;$loop_to&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/mt:For&gt;&lt;/mt:SetVarBlock&gt;&lt;option value=&quot;&lt;$mt:CategoryID$&gt;&quot;&gt;&lt;$mt:Var name=&quot;spacer&quot;$&gt;&lt;$mt:CategoryLabel$&gt;&lt;/option&gt;
                &lt;$mt:SubCatsRecurse$&gt;
            &lt;/mt:TopLevelCategories&gt;
            &lt;/select&gt;
        &lt;/mt:SetVarBlock&gt;
        &lt;$mt:Include module=&quot;フォームフィールド&quot; id=&quot;entry-category&quot; class=&quot;&quot; label=&quot;カテゴリ&quot;$&gt;
    &lt;/mt:If&gt;

    &lt;mt:EntryCustomFields&gt;
        &lt;mt:SetVarBlock name=&quot;custom_field_name&quot;&gt;&lt;$mt:CustomFieldName$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;field-content&quot;&gt;&lt;$mt:CustomFieldHTML$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;custom_field_id&quot;&gt;profile_&lt;$mt:CustomFieldName dirify=&quot;1&quot;$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;$mt:Include module=&quot;フォームフィールド&quot; id=&quot;$custom_field_id&quot; class=&quot;&quot; label=&quot;$custom_field_name&quot;$&gt;
    &lt;/mt:EntryCustomFields&gt;
    &lt;input type=&quot;submit&quot; accesskey=&quot;s&quot; name=&quot;post&quot; id=&quot;entry-submit&quot; value=&quot;投稿&quot; /&gt;
&lt;/form&gt;
&lt;mt:Else&gt;
&lt;p id=&quot;login_message&quot;&gt;&lt;/p&gt;
&lt;/mt:IfLoggedIn&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
mtAttachEvent('usersignin', entry_create_loggedin);
//--&gt;
&lt;/script&gt;
</pre>
</code>

<p>これを、以下のように変更するとよいでしょう。</p>

<code>
<pre class="withScrl">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
function entry_create_loggedin() {
    var u = mtGetUser();
    var loggedin = u &amp;&amp; u.is_authenticated &amp;&amp; u.is_author ? true : false;
    var eid = 'logged_in';
    conditional_block(loggedin, eid);
    if (!loggedin) {
        var p = document.getElementById('login_message');
        if (!p) return;
        if (u &amp;&amp; !u.is_author) 
            p.innerHTML = &quot;ブログに投稿する前に登録を行ってください。&quot;;
        else
            if (u &amp;&amp; !u.can_post)
                p.innerHTML = &quot;投稿する権限がありません。&quot;;
            else
                p.innerHTML = '&lt;a href=&quot;javascript:void(0)&quot; onclick=&quot;return mtSignInOnClick(\'login_message\')&quot;&gt;サインインしてブログ記事を投稿してください。&lt;/a&gt;';
    } else {
        var mt = document.getElementById('magic_token');
        if (mt) mt.value = u.sid;
    }
}
// --&gt;
&lt;/script&gt;
&lt;mt:IfLoggedIn script=&quot;entry_create_loggedin&quot;&gt;
&lt;form method=&quot;post&quot; action=&quot;&lt;$mt:CGIPath$&gt;&lt;$mt:CommunityScript$&gt;&quot; name=&quot;entry_form&quot; id=&quot;create-entry-form&quot; enctype=&quot;multipart/form-data&quot;&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;__mode&quot; value=&quot;post&quot; /&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;blog_id&quot; value=&quot;&lt;$mt:BlogID$&gt;&quot; /&gt;
    &lt;input type=&quot;hidden&quot; id=&quot;magic_token&quot; name=&quot;magic_token&quot; value=&quot;&quot; /&gt;
    &lt;mt:SetVarBlock name=&quot;field-content&quot;&gt;&lt;input id=&quot;entry-title&quot; class=&quot;ti&quot; name=&quot;title&quot; /&gt;&lt;/mt:SetVarBlock&gt;
    &lt;$mt:Include module=&quot;フォームフィールド&quot; id=&quot;entry-title&quot; class=&quot;&quot; label=&quot;タイトル&quot;$&gt;

    &lt;mt:SetVarBlock name=&quot;field-content&quot;&gt;&lt;textarea id=&quot;entry-body&quot; class=&quot;ta&quot; name=&quot;text&quot; rows=&quot;15&quot; cols=&quot;50&quot;&gt;&lt;/textarea&gt;&lt;/mt:SetVarBlock&gt;
    &lt;$mt:Include module=&quot;フォームフィールド&quot; id=&quot;entry-body&quot; class=&quot;&quot; label=&quot;本文&quot;$&gt;

    &lt;mt:If tag=&quot;BlogCategoryCount&quot;&gt;
        &lt;mt:SetVarBlock name=&quot;field-content&quot;&gt;
            &lt;select id=&quot;entry-category&quot; name=&quot;category&quot;&gt;
                &lt;option value=&quot;0&quot;&gt;カテゴリを選択...&lt;/option&gt;
            &lt;mt:TopLevelCategories&gt;
                &lt;mt:SetVarBlock name=&quot;loop_to&quot;&gt;&lt;$mt:Var name=&quot;__depth__&quot; _default=&quot;0&quot;$&gt;&lt;/mt:SetVarBlock&gt;&lt;mt:SetVarBlock name=&quot;spacer&quot;&gt;&lt;mt:For start=&quot;1&quot; end=&quot;$loop_to&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/mt:For&gt;&lt;/mt:SetVarBlock&gt;&lt;option value=&quot;&lt;$mt:CategoryID$&gt;&quot;&gt;&lt;$mt:Var name=&quot;spacer&quot;$&gt;&lt;$mt:CategoryLabel$&gt;&lt;/option&gt;
                &lt;$mt:SubCatsRecurse$&gt;
            &lt;/mt:TopLevelCategories&gt;
            &lt;/select&gt;
        &lt;/mt:SetVarBlock&gt;
        &lt;$mt:Include module=&quot;フォームフィールド&quot; id=&quot;entry-category&quot; class=&quot;&quot; label=&quot;カテゴリ&quot;$&gt;
    &lt;/mt:If&gt;

&lt;mt:Ignore&gt;&lt;!--[GoogleMap]--&gt;&lt;/mt:Ignore&gt;

&lt;div id=&quot;map&quot; style=&quot;width: 500px; height: 350px; border: 1px solid #ccc; margin-bottom: 20px;&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;googlemap-location&quot; style=&quot;padding: 5px 5px 10px 5px;&quot;&gt;
    &lt;__trans phrase=&quot;Lat.&quot;&gt;&lt;br /&gt;
    &lt;input type=&quot;text&quot; name=&quot;lat&quot; id=&quot;lat&quot; class=&quot;full-width&quot; value=&quot;&lt;mt:var name=&quot;lat&quot;&gt;&quot; /&gt;&lt;br /&gt;
    &lt;__trans phrase=&quot;Lon.&quot;&gt;&lt;br /&gt;
    &lt;input type=&quot;text&quot; name=&quot;lon&quot; id=&quot;lon&quot; class=&quot;full-width&quot; value=&quot;&lt;mt:var name=&quot;lon&quot;&gt;&quot; /&gt;
&lt;/div&gt;
&lt;div id=&quot;view&quot; style=&quot;width: 500px; height: 350px; border: 1px solid #ccc; margin-bottom: 20px;&quot;&gt;&lt;/div&gt;

&lt;mt:Ignore&gt;&lt;!--/[GoogleMap]--&gt;&lt;/mt:Ignore&gt;

    &lt;mt:EntryCustomFields&gt;
        &lt;mt:SetVarBlock name=&quot;custom_field_name&quot;&gt;&lt;$mt:CustomFieldName$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;field-content&quot;&gt;&lt;$mt:CustomFieldHTML$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;mt:SetVarBlock name=&quot;custom_field_id&quot;&gt;profile_&lt;$mt:CustomFieldName dirify=&quot;1&quot;$&gt;&lt;/mt:SetVarBlock&gt;
        &lt;$mt:Include module=&quot;フォームフィールド&quot; id=&quot;$custom_field_id&quot; class=&quot;&quot; label=&quot;$custom_field_name&quot;$&gt;
    &lt;/mt:EntryCustomFields&gt;
    &lt;input type=&quot;submit&quot; accesskey=&quot;s&quot; name=&quot;post&quot; id=&quot;entry-submit&quot; value=&quot;投稿&quot; /&gt;
&lt;/form&gt;
&lt;mt:Else&gt;
&lt;p id=&quot;login_message&quot;&gt;&lt;/p&gt;
&lt;/mt:IfLoggedIn&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
mtAttachEvent('usersignin', entry_create_loggedin);
//--&gt;
&lt;/script&gt;
</pre>
</code>

<p>MTCS のデフォルト状態であれば、これで投稿の際に GoogleMap とストリートビューが読み込まれるようになりますが、テンプレートの設定によっては、GoogleMap を呼び出す Javascript が読み込まれないかもしれません。その場合は、投稿画面の <head> 〜 </head> 内で、先ほど設定した GoogleMap 読み込みのためのスクリプトが読み込まれるようにテンプレートを設定してください。</p>

<h4 class="contentsSubTitle">使用にあたってとか修正依頼とかダメ出しとか人生相談とか</h4>

<p>基本的にご利用は無償かつ自己責任ですが、よろしければ寄付をご検討ください。詳細については、<a href="mailto:weeeblog@gmail.com" title="weeeblog@gmail.com へのメール">weeeblog@gmail.com</a> までお問い合わせください。</p>

<p>また、フィードバックいただけるとうれしいです。ぜひ <a href="mailto:weeeblog@gmail.com" title="weeeblog@gmail.com へのメール">weeeblog@gmail.com</a> までお送りください。コメントやトラックバックでもかまいません。人生相談は<span class="notice">20代</span>の女性に限りますが、それ以外は応相談(※フィードバックは女性でなくともかまいませんが、いずれにしてもいまだにいただいたことはありません)。</p>]]>
        
    </content>
</entry>

<entry>
    <title>ふたつのメール</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/26_0059.php" />
    <id>tag:mtos.weeeblog.net,2008://1.672</id>

    <published>2008-07-25T15:59:25Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>朝イチから、既に納品した案件の後始末に追われる。一緒に仕事していた運営陣の不備だ...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="life" label="Life" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="working" label="Working" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>朝イチから、既に納品した案件の後始末に追われる。一緒に仕事していた運営陣の不備だが、クライアントとの中が炎上中でどうにもならないらしく、とりあえず事態の収拾を最優先とするしかない状況。終電間際だったので処理は今日にまわしたが、この点については昨晩遅くにメールが来ていた。「内部からアラートが出なかったのは非常に残念です」だと。あなたが手配したものが使えねーからこうするよって伝えたやんけボケが、違うもの手配しろって言ったのにさっさとやらないから後で予期しないツケが来るんだよバカどもがヴォケがタコが…と言いたくなるがこらえる。でも【緊急】とかメールの件名についてるのにいつまでたっても作業分担送ってこないのでさすがに電話してちょっと注意した。何のためにいるんだオマエはYO。おれが電話するまで何してたYO。給料いくらだYO。と言いたかったがそれはがまんした</p>

<p>自分で後始末できないのは仕方ないし、そういうものは僕にもあり余るほどあるけれど、それなら指示出して制作回していく人間はこういうことにならないようにしなきゃいけないんだし、なってもこっちに責任をまわそうとするのは何か違うと思っている。とりあえず事態の収拾を最優先するしかないので作業お願いします、とだけ潔く言ってくれればなんとかしてやんなきゃなあ、と思いながら作業するのになんでわざわざ余計な一言を付け加える。僕にとってこういうことは、メールの文面とか言い回しがどうのこうのいう問題ではなく、作業するにあたり必要な人件費の問題でもない(いや、これはちょっとあるか…)。忙しいのによーなどというより何より、なんか、かっこわるいなあ、と思う(でも、それでも制作陣を動かして作業させたのだから、その人は少なくとも今はしっかり自分の役目を果たしたのだとも思っている)。</p>

<p>まあ、クライアントとの折衝はそれはそれで大変な仕事なのは前の会社で嫌というほど味わったし、運営陣が別にいることでそれを自分から切り離しておけるタイプの案件の制作は、幾分か気分的に楽ではある。次から自分も気をつけとかなきゃ…と思いつつ仕方なく作業する。その間にも他の案件も進めておかなきゃならないので、各方面に連絡入れつつ、後始末完了 21 時。メールで作業した詳細と、次行程に渡すためのアクセス情報など送って、念のため電話入れとく。はあ。明日出勤しない予定なので一応携帯番号伝えておいたが、連絡がないことを祈る。</p>

<p>そこから本来の今日の仕事として予定していたプラグイン製品の修正にかかる。丸一日費やしたのは非常にイタイが、今日入って来たオフレコ情報もあり、いくつか必要な修正とチェックしておいて来週の予定うまく組めれば明日明後日はなんとか休めるかな、と思っていた矢先、先に帰ったスタッフが、頼んでいたドキュメント作成をやってくれていないのに気づく。あー…。コンペ企画書の作成フローに関するレビューだが、こういうものは日がたってしまうと色あせてしまうので、今週がリミットと伝えてあった。が、もう仕方なかろう。前の会社の人たちと飲みに行くっていってたし、明日は浜松に出かけるって言ってたし、iPhone 買ってうかれてたみたいだし、そもそも僕が自主的にやらせたものなので、必須事項ではない。でもオフィス間で共有しときたいこともあったし、週明けに僕の方で簡単にまとめてまわしておく程度でいいか。頼んだうなぎパイちゃんと買って来てくれたらそれでよしとしよう。うなぎパイでなくうなぎだったらもっとよしとしよう</p>

<p>と思ったら、次に帰ったスタッフが、頼んでいた不要書類の整理をやってくれていないのに気づく。あー…業者に処分を頼むのだけれど、先に概算を経理に通しておかなくてはならないので分量がどのくらいになるか再度整理せよ、と社長のお達しがあって、今日はさすがに手が離せなかったので頼んでいた。一緒に出した物品購入申請が、期首に出すことになってしまったので印象が良くなく、追って具体的に整理しなければならないとしても、概算の連絡だけは今週中にすませておきたかった。大阪オフィスは 4 人。今日は社長がいないので、二人帰ると必然的に僕一人になる。やっておくより他にないので、またしても終電ぎりぎりになったがあわてて棚から書類を引っ張りだして確認する。</p>

<p>おおむね不要と判断できるものばかりだったけれど、ちょっと不思議だった。書類の量が多いのと、どの書類からも、時間に追われていているものの、とても丁寧に仕事をしている印象を受けた。僕は立場上より多くの案件に関わる方なのだけれど、ここ最近の案件で、制作上の手戻りや担当の把握漏れ、伝達漏れが目立っており、頻繁に社長から注意がある。ここに書くようなことかどうかはわからないが、正直、仕事の進行が雑になっているのが気になっていて、少なくとも制作フローに関しては、今よりも入社当時の方がはるかに印象が良い。たぶん、その質が落ちたのはある程度各員の裁量で進めるようになってからだろうから、僕も気をつけておかなくちゃいけないだろう。僕が入る前にここにいたこの人やこの人が担当した案件はどうだったんだろうか。一人、よく話題になるちょっとだけかわいそうな方は知っているが、知らない名前も数人あった。</p>

<p>ぼんやり考えながらもどのくらいの分量になりそうかと、今日の作業報告をばたばたとメールで送り、あわててゴミを一週間分まとめて、後片付けをして出る。うーんなぜ最後まで仕事がんばってるヤツがゴミ出ししなきゃならんのだろう。施錠とかはわかるんだけれど。最初に帰る人か、そうでないならみんなでやることのような気がする。が、別にぐだぐだ言うことでもないしそもそも自分一人しかいないので黙々やる。今日は終日他人の後始末ばっかりだった。気が滅入るということはないけれど、社内にせよ社外にせよ、自分より仕事してないと思う人に余計な仕事増やされると、さすがにイライラすることもある。それでも、プラグインのデバッグもいくつかできたし、最低限やらなきゃいけないことはなんとかやった。来週はもっとキツくなりそうだけれど…</p>

<p>なんとかぎりぎり、終電に乗る。これがまた、天神祭だ。なんだ。なんか悪いことしたかおれ。なんでこんなにツイてないんだ今日。まあ電車が混むのは仕方ないか…。窮屈なのはみんな一緒だし、こんな時間に帰ってるおれにも原因があるしな…ん？なんでこんな時間になったんだっけな…</p>

<p>帰宅して、風呂くらいはゆっくり入る。コンビニで買った晩ごはんを食べて、ﾔｯﾃﾗﾝﾈｰﾖ(*｀⊿´) ｹｯ とばかりに買ったお酒を飲みながら今日届いたメールにひととおり目を通す。珍しく母親が送ってきていた。件名に「○○ ○○です」とフルネームで入れているあたりメール初心者だ。自分の息子に宛てるのに名字はいらんですよ、さすがに</p>

<p>彼女はもう 60 歳近いが、僕と妹が大学に進学して、人生のつとめが 7 割方終わったあと、自分も受験勉強して、3 年かかって地元の大学の法学部の夜間コースに入った。だが祖母の介護もあり、年齢的にもついていくのがやっとのことらしく、一年余計に通学しなきゃいけないことになりそうなので、たまたま今年ボーナスをたくさんもらえた僕がその分の学費を負担することにし、先日銀行振込で送ったので、そのお礼に送ってきてくれたメールだった。</p>

<p>パソコンでメールを書くよりも手で書いた方が早い彼女がメールを送ってきたのはこれが二回目で、情報処理の授業があった日に、練習メールを送ってきたのが最初だ。今日は試験の中休みだったらしく、早くお礼を伝えたかった、といったようなことが書いてある。文面はたまに送ってくる手紙と変わらないけれど、進学とともに家を出てから、最初に米やら何やら、短い手紙とともに段ボールにぎっしり食料をつめて送ってきてくれた時の次に嬉しかった。僕が送ったお金もそれを稼ぐのに必要だった時間も、彼女がかつて僕のために費やしてくれたお金と時間には遠く及ばないけれども、少しでも報いることができたことがわかって、少しうるうる来る。</p>

<p>些細な出来事だけれども、今日あったことを何もかもリセットしてくれて、頭の中をすっきりさせてくれる。あー明日もがんばるかあ、と思わせてくれる。当面の間は仕事ざかりでありたい僕にはその原動力になるものがとても大切で、それが何であってもかまわないけれど、それ以外のものはしばらく必要ないと思っている。うん、あしたもがんばるわ</p>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition で 手軽に WEB サーバを構築する</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_2127.php" />
    <id>tag:mtos.weeeblog.net,2008://1.673</id>

    <published>2008-07-20T12:27:56Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>頂き物の元 Windows マシンに Ubuntu Gutsy を入れて使ってい...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="trac" label="Trac" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>頂き物の元 Windows マシンに Ubuntu Gutsy を入れて使っていた自宅サーバがどうにもならんくらいにうんうんうなりだしたので、一時は <a href="http://www.slicehost.com/" target="_blank">slicehost</a> を借りての構築を考えていたのですが、一番安いメモリ 256MB のコースで年間 $240 っていうのは、安いけど払い捨てになるのがちょっときつくて、どうせならと新しいサーバを購入しました。<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。ちょっと怖かったけど、 Yahoo! オークションにメモリ 2GB のものが 2 万 7 千円で出品されていたので購入してみました(実際には終了までに 3 万円ちょっとまで値上がりしましたが…)。とりあえずちゃんと動いてくれています。</p>

<p>実際にはまあ、このサーバも一人暮らしの部屋に僕と同居するには、ファンの音がややうるさいし、放熱で少し部屋が暑くなっているような気もするのですが、そこは目をつぶることにして、とりあえず Ubuntu 8.04 LTS(Hardy Heron) Server Edition を使って、ローカルでのシンプルな WEB サーバ構築を始めました。以下に行った手順を書いています。僕は自分用メモみたいな記事はあまり好きではないので、一応ちゃんと動作確認したもののみ。僕と同じサーバを買って、以下の手順通りに進めれば、早ければ全部終わるまで、3 時間もかからないと思います。</p>

<ul class="itemList1">
<li><a href="/logs/2008/07/20_1631.php">Ubuntu 8.04 LTS(Hardy Heron) Server Edition をセットアップする</a></li>
<li><a href="/logs/2008/07/20_1632.php">Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、デスクトップ版のグラフィカルな <abbr title="User Interface">UI</abbr> を載せる</a></li>
<li><a href="/logs/2008/07/20_1739.php">Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、ProFTP をインストールする</a></li>
<li><a href="/logs/2008/07/20_1751.php">Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、phpMyAdmin をインストールする</a></li>
<li><a href="/logs/2008/07/20_1821.php">Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、phpPgAdmin をインストールする</a></li>
<li><a href="/logs/2008/07/20_1845.php">Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、Webmin をインストールする</a></li>
<li><a href="/logs/2008/07/20_1912.php">Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、Trac をインストールする</a></li>
<li><a href="/logs/2008/07/20_1932.php">Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、HyperEstraier をインストールする</a></li>
</ul>

<p>※ ちなみに、<a href="http://www.slicehost.com/" target="_blank">slicehost</a> を借りて即解約した場合、一ヶ月分だけは料金をとられますが、それ以外は返金されるようです。僕は 12 ヶ月で申し込んでいたので、ちょっとどきどきしながらサポートの人にそのあたり確認しました。まあディポジットなんだから、そうしてくれないと困るんですが…</p>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、HyperEstraier をインストールする</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_1932.php" />
    <id>tag:mtos.weeeblog.net,2008://1.674</id>

    <published>2008-07-20T10:32:16Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアA...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="hyperestraier" label="HyperEstraier" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>※ 今回構築中のマシンは、<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。</p>

<p>HyperEstraier 専用にバーチャルホストを設定し、ブラウザから全文検索できるように設定します。</p>

<h4 class="contentsSubTitle">Ubuntu Server Edition への HyperEstraier のインストール</h4>

<p>apt を使って HyperEstraier をインストールします。</p>

<code>
<pre>
sudo apt-get install hyperestraier
sudo apt-get install wv xlhtml ppthtml
</pre>
</code>

<p>起動時に Hyper Estraier を自動起動する設定にします。</p>

<code>
<pre>
sudo vi /etc/default/hyperestraier
</pre>
</code>

<code>
<pre>
NO_START=1 -> NO_START=0
</pre>
</code>

<p>cgi などのファイルを配置し、設定ファイルを編集します。</p>

<code>
<pre>
sudo cp /usr/lib/estraier/estseek.cgi /www/sites/hyperestraier.weeeblog.net/htdocs/estseek.cgi
sudo cp /usr/share/hyperestraier/locale/ja/estseek.* /www/sites/hyperestraier.weeeblog.net/htdocs/
sudo vi /www/sites/hyperestraier.weeeblog.net/htdocs/estseek.conf
</pre>
</code>

<code>
<pre>
indexname: /www/sites/hyperestraier.weeeblog.net/casket
replace: ^file:///www/sites/weeeblog.net/htdocs/{{!}}http://weeeblog.net/
deftitle: Weeeblog.net::HyperEstraier
</pre>
</code>

<p>アーカイブの拡張子を .html にしている場合は、以下のコマンドでインデックスを作成し、<a href="#vhostSetting">バーチャルホストの設定の項目</a>に進みます。</p>

<code>
<pre>
cd /www/sites/hyperestraier.weeeblog.net
sudo estcmd gather -il ja -pc <abbr title="Unicode Transformation Format">UTF</abbr>-8 -sd casket /www/sites/weeeblog.net/htdocs
</pre>
</code>

<p>アーカイブの拡張子を .php にしている場合はインデックス対象に含まれないので、<abbr title="Movable Type">MT</abbr> のアーカイブを利用して、インデックスのための文書ドラフトを吐かせるようにします(アーカイブの拡張子が .html の場合は以下は飛ばして<a href="#vhostSetting">バーチャルホストの設定の項目</a>に進んでください)。</p>

<code>
<pre>
@uri=&lt;$MTBlogArchiveURL$&gt;&lt;$MTEntryDate format=&quot;%y/%m/%d_%h%n&quot;$&gt;&lt;$MTBlogFileExtension$&gt;
@title=&lt;$MTEntryTitle$&gt;
@author=&lt;$MTEntryAuthor$&gt;
@cdate=&lt;$MTEntryDate format=&quot;%Y-%m-%dT%H:%M:%S+09:00&quot;$&gt;
@mdate=&lt;$MTEntryModifiedDate format=&quot;%Y-%m-%dT%H:%M:%S+09:00&quot;$&gt;
&lt;MTEntryIfTagged&gt;category=&lt;MTEntryTags glue=&quot;,&quot;&gt;&lt;$MTTagName$&gt;&lt;/MTEntryTags&gt;&lt;/MTEntryIfTagged&gt;

&lt;$MTEntryBody addblogurl=&quot;1&quot; addtext=&quot;1&quot; remove_html=&quot;1&quot;&gt;
&lt;MTIfNonEmpty tag=&quot;EntryMore&quot;&gt;&lt;$MTEntryMore remove_html=&quot;1&quot;$&gt;&lt;/MTIfNonEmpty&gt;
    &lt;$MTEntryTitle$&gt;
</pre>
</code>

<p>アーカイブマッピングは、「draft/%y/%m/%d_%h%n.est」のようにしておきます。優先アーカイブは、本来あったもののままにしておきます。</p>

<p>ここまでの設定ができたら、以下のコマンドでインデックスを作成します。</p>

<code>
<pre>
cd /www/sites/hyperestraier.weeeblog.net
sudo estcmd gather -il ja -pc <abbr title="Unicode Transformation Format">UTF</abbr>-8 casket /www/sites/weeeblog.net/htdocs/logs/draft
</pre>
</code>

<p>念のため、draft ディレクトリへの WEB アクセスができないようにしておきます。</p>

<code>
<pre>
sudo vi /www/sites/weeeblog.net/htdocs/logs/draft/.htaccess
</pre>
</code>

<code>
<pre>
deny from all
</pre>
</code>

<p>以下はおまけですが、ついでにステータスが 403 や 404 の場合に返すページを作っておきましょう。</p>

<code>
<pre>
sudo vi /etc/apache2/sites-enabled/weeeblog.net
</pre>
</code>

<code>
<pre>
# Options に -Indexes を追加すること
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
</pre>
</code>

<code>
<pre>
sudo vi /www/sites/weeeblog.net/htdocs/403.html
sudo vi /www/sites/weeeblog.net/htdocs/404.html
</pre>
</code>

<h4 class="contentsSubTitle" id="vhostSetting">バーチャルホストの設定</h4>

<code>
<pre>
sudo mkdir -p /www/sites/hyperestraier.weeeblog.net/htdocs
sudo chown -R www-data:www-data /www/sites/hyperestraier.weeeblog.net/htdocs
sudo vi /etc/apache2/sites-enabled/hyperestraier.weeeblog.net
</pre>
</code>

<code>
<pre class="withScrl">
&lt;virtualHost *&gt;
    ServerName hyperestraier.weeeblog.net
    DocumentRoot /www/sites/hyperestraier.weeeblog.net/htdocs

    ErrorLog /www/sites/hyperestraier.weeeblog.net/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel info

    CustomLog /www/sites/hyperestraier.weeeblog.net/access.log combined
    ServerSignature On

    &lt;Location /&gt;
        AddType application/x-httpd-cgi .cgi
        AddType application/x-httpd-php .php .phtml .php3
        AddType application/x-httpd-php-source .phps
        DirectoryIndex index.phtml index.fcgi index.html index.cgi index.pl index.php index.xhtml

        Options ExecCGI +Indexes FollowSymLinks MultiViews
#        AllowOverride None
        Order allow,deny
        allow from all
    &lt;/Location&gt;
&lt;/virtualHost&gt;
</pre>
</code>

<p>アクセス制限は適宜行ってください。また、ドキュメントルートを見せる必要がない場合はリダイレクト設定をしておきます。</p>

<code>
<pre>
sudo vi /www/sites/hyperestraier.weeeblog.net/htdocs/.htaccess
</pre>
</code>

<code>
<pre>
RewriteEngine on
RewriteRule ^$ /estseek.cgi
</pre>
</code>

<p>バーチャルホスト設定を書いたら、再起動して、ちゃんと設定ができているか確認します。</p>

<code>
<pre>
sudo /etc/init.d/apache2 restart
</pre>
</code>

<code>
<pre>
# ブラウザでアクセス
http://hyperestraier.weeeblog.net/
</pre>
</code>

<p>この時点では HyperEstraier のデフォルトのテンプレートなので、<abbr title="Movable Type">MT</abbr> で HyperEstraier 用のテンプレートを作成します。</p>

<code>
<pre>
sudo mkdir -p /www/sites/weeeblog.net/htdocs/tmpl/hyperestraier
sudo chown -R www-data:www-data /www/sites/weeeblog.net/htdocs/tmpl/hyperestraier
</pre>
</code>

<p>インデックステンプレートで作成し、出力ファイル名を「tmpl/hyperestraier/estseek.tmpl」とします。</p>

<code>
<pre class="withScrl">
&lt;MTSetVarBlock name=&quot;page_title&quot;&gt;Search by HyperEstraier: &lt;$MTBlogName$&gt;&lt;/MTSetVarBlock&gt;&lt;$MTSetVar name=&quot;prev&quot; value=&quot;&quot;$&gt;&lt;$MTSetVar name=&quot;next&quot; value=&quot;&quot;$&gt;&lt;$MTInclude module=&quot;docHeaderforCGI&quot;$&gt;
    &lt;body id=&quot;hyperestraier&quot;&gt;
        &lt;div id=&quot;container&quot; style=&quot;top:0px;&quot; onmouseover=&quot;naviSlider('out')&quot;&gt;
&lt;$MTInclude module=&quot;siteNavigation&quot;$&gt;
            &lt;!--[contents]--&gt;
            &lt;div id=&quot;contents&quot;&gt;
                &lt;hr class=&quot;docSeparate&quot; /&gt;
                &lt;!--[mainContents]--&gt;
                &lt;div id=&quot;mainContents&quot;&gt;
                    &lt;h2 id=&quot;aboutTitle&quot; class=&quot;pageTitle&quot;&gt;About&lt;/h2&gt;
                    &lt;!--[main]--&gt;
                    &lt;div id=&quot;main&quot;&gt;
                        &lt;h3 class=&quot;contentsTitle&quot;&gt;Search by HyperEstraier&lt;/h3&gt;

&lt;style type=&quot;text/css&quot;&gt;html {
  margin: 0em 0em; padding: 0em 0em;
  background: #ffffff none;
}
body {
  margin: 0em 0em; padding: 0em 0em;
  color: #111111;
}
div.estform {
  margin: 0.8em 1.0em; padding: 0em 1.0em;
  background: #eeeeff none; border: solid 1pt #bbbbcc;
  -moz-border-radius: 0.4em;
}
div.form_navi {
  position: absolute; top: 1.5em; right: 2em;
  margin: 0em 0em; padding: 0em 0em; text-align: right;
  font-size: smaller;
}
div.form_navi a,div.form_navi span {
  display: block; margin: -0.1em 0em; padding: 0em 0em;
}
a.navilink {
  color: #5588cc; text-decoration: none;
}
a.navilink:hover {
  color: #4499ee; text-decoration: underline;
}
span.navivoid {
  color: #99aaaa;
}
div.form_advanced {
  margin: 0.4em 0em; padding: 0em 0em;
}
th.ilabel {
  padding-right: 0.3em; text-align: right;
  font-weight: normal; font-size: smaller;
}
td.ivalue input.submit {
  width: 12em;
}
td.ivalue input.reset {
  width: 5em;
}
div.form_basic {
  margin: 0.4em 0em 0em 0em; padding: 0em 0em;
  font-size: smaller;
}
input.submit:hover,select:hover {
  cursor: pointer;
}
div.form_extension,div.form_genrecheck {
  margin: 0.3em 0em 0.3em 0em; padding: 0em 0em;
  font-size: smaller;
}
label.genrecheck {
  margin-right: 0.5em;
}
span.inputunit {
  margin: 0em 0.3em;
}
input.button {
  margin: 0.1em 0.1em; padding: 0em 0.5em;
  background: #dddddd none; border: solid 1pt #cccccc;
  -moz-border-radius: 0.3em;
  color: #888888;
}
input.button:hover {
  cursor: pointer;
}
input.abutton {
  background: #ccccdd none; border: inset 1pt #bbbbbb;
  color: #222222;
}
input.wbutton {
  width: 7.5em;
}
input.mbutton {
  width: 6.0em;
}
input.nbutton {
  width: 4.5em;
}
div.estresult {
  margin: 1.0em 1.0em; padding: 0em 0em;
}
div.resinfo {
  margin-right: 0.3em; text-align: right;
  font-size: smaller;
}
div.hints {
  margin-right: 0.8em; text-align: right;
  font-size: smaller; color: #555555;
}
div.relkeys {
  margin-right: 0.3em; text-align: right;
  font-size: smaller; color: #555555;
  opacity: 0.70;
}
div.relkeys a {
  color: #007777; text-decoration: none;
}
div.relkeys a:hover {
  color: #0066dd; text-decoration: underline;
}
dl.doc {
  margin: 1.3em 0em;
}
dl.doc dd {
  font-size: smaller; color: #222222;
}
a.doc_title {
  color: #0011ee; text-decoration: underline;
}
a.doc_title:hover {
  color: #0033ff; text-decoration: underline;
}
span.doc_score {
  font-size: smaller; color: #555555;
}
span.doc_score:before {
  content: &quot;(&quot;;
}
span.doc_score:after {
  content: &quot;)&quot;;
}
span.doc_link {
  color: #007744;
}
dd.doc_attr {
  margin: 0em 0.8em;
}
span.doc_val {
  color: #111111;
}
dd.doc_text {
  margin: 0em 1.3em;
}
strong.key {
  margin: 0em -0.1em; padding: 0em 0.1em;
  color: #000011;
  -moz-border-radius: 0.3em;
}
strong.key1 { background-color: #ffffcc; }
strong.key2 { background-color: #ffeeee; }
strong.key3 { background-color: #eeeeff; }
strong.key4 { background-color: #eeffdd; }
code.delim { color: #555555; letter-spacing: -0.1em; }
dd.doc_navi {
  margin: 0em 1.1em;
}
div.doc_clip {
  margin-left: 2.5em; margin-top: -0.6em;
}
div.doc_clip p {
  font-size: smaller; color: #444444;
}
a.display,a.detail,a.similar,a.dir,a.include {
  color: #007777; text-decoration: none;
}
a.display:hover,a.detail:hover,a.similar:hover,a.dir:hover,a.include:hover {
  color: #0066dd; text-decoration: underline;
}
p.note {
  margin: 3em 1.5em;
  color: #444444;
}
div.paging {
  margin: 2em 1em; text-align: right;
  font-size: smaller;
}
a.navi {
  margin: 0em 0.2em; padding: 0em 0.5em;
  background: #eeeeff none; border: solid 1pt #bbbbcc;
  -moz-border-radius: 0.25em;
  color: #0022aa; text-decoration: none;
}
span.void {
  margin: 0em 0.2em; padding: 0em 0.5em;
  background: #eeeeee none; border: solid 1pt #bbbbcc;
  -moz-border-radius: 0.25em;
  color: #aaaaaa;
  opacity: 0.70;
}
a.pnum {
  margin: 0em 0em; padding: 0em 0.2em;
  background: #eeeeff none; border: solid 1pt #bbbbcc;
  -moz-border-radius: 0.25em;
  font-size: smaller; color: #0022aa; text-decoration: none;
}
span.pnow {
  margin: 0em 0em; padding: 0em 0.2em;
  background: #ffeedd none; border: solid 1pt #bbbbcc;
  -moz-border-radius: 0.25em;
}
div.estinfo {
  margin: 1.5em 1.0em; padding: 0em 0em; text-align: right;
  font-size: smaller; color: #555555;
  opacity: 0.80;
}
div.estinfo a {
  color: #555555; text-decoration: none;
}
div.logo {
  margin: 15.0em 1em; text-align: center;
}
div.logo h1 {
  color: #000000;
}
div.logo div.caption {
  margin-top: -0.9em;
  color: #222222;
}
div.help {
  margin: 2em 4em; padding: 2em 2em;
  background-color: #eeeeff; border: 2pt solid #ddddee;
  -moz-border-radius: 0.8em;
}
div.help h1 {
  margin: -1em 0em; padding: 0em 0em; text-align: right;
  font-weight: normal; font-size: smaller;
}
div.help h2 {
  margin-top: 1.2em;
}
div.help p {
  line-height: 145%; text-indent: 0.8em;
}
div.help pre {
  margin: 0em 2em; padding: 0em 0.2em;
  background-color: #ffffff; border: 1pt solid #999999;
  -moz-border-radius: 0.2em;
}
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot;&gt;function startup(){
  if((document.location + &quot;&quot;).indexOf(&quot;#&quot;) != -1) return;
  var elem = document.getElementById(&quot;phrase&quot;);
  if(elem) elem.focus();
}
window.onload = startup;
function changemax(){
  var elem = document.getElementById(&quot;form_self&quot;);
  if(elem) elem.submit();
}
function changeclip(){
  var elem = document.getElementById(&quot;form_self&quot;);
  if(elem) elem.submit();
}
function changetarget(value){
  var felem = document.getElementById(&quot;form_self&quot;);
  if(felem){
    var aelem = document.getElementById(&quot;attr&quot;);
    if(aelem) aelem.value = value;
    felem.submit();
  }
}
function changeorder(value){
  var felem = document.getElementById(&quot;form_self&quot;);
  if(felem){
    var oelem = document.getElementById(&quot;order&quot;);
    if(oelem) oelem.value = value;
    felem.submit();
  }
}
&lt;/script&gt;

&lt;!--ESTFORM--&gt;

&lt;!--ESTRESULT--&gt;

&lt;!--ESTINFO--&gt;

                    &lt;/div&gt;
                    &lt;!--/[main]--&gt;
                &lt;/div&gt;
                &lt;!--/[mainContents]--&gt;
                &lt;hr class=&quot;docSeparate&quot; /&gt;
&lt;$MTInclude module=&quot;navigation&quot;$&gt;
            &lt;/div&gt;
            &lt;!--/[contents]--&gt;
            &lt;hr class=&quot;docSeparate&quot; /&gt;
&lt;$MTInclude module=&quot;footerNavigation&quot;$&gt;
        &lt;/div&gt;
&lt;$MTInclude module=&quot;functions&quot;$&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
</code>

<p>出力したファイルにシンボリックリンクを張ります。こうしておくと、<abbr title="Movable Type">MT</abbr> でテンプレート管理できる上に、リンク先を維持できるので便利です。</p>

<code>
<pre>
cd /www/sites/hyperestraier.weeeblog.net/htdocs
sudo mv estseek.tmpl estseek.tmpl.original
sudo ln -s /www/sites/weeeblog.net/htdocs/tmpl/hyperestraier/estseek.tmpl .
sudo ln -s /www/sites/weeeblog.net/htdocs/common .
</pre>
</code>

<p>再度ブラウザでアクセスして、ちゃんと設定できたかどうか確認します。</p>

<code>
<pre>
# ブラウザでアクセス
http://hyperestraier.weeeblog.net/
</pre>
</code>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、Trac をインストールする</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_1912.php" />
    <id>tag:mtos.weeeblog.net,2008://1.675</id>

    <published>2008-07-20T10:12:16Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアA...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="trac" label="Trac" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>※ 今回構築中のマシンは、<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。</p>

<p>Trac 専用にバーチャルホストを設定し、ブラウザからデータベースを操作できるように設定します。</p>

<h4 class="contentsSubTitle">Ubuntu Server Edition への Trac のインストール</h4>

<p>先に、必要なものをインストールしておきます。</p>

<code>
<pre>
sudo apt-get install subversion
sudo apt-get install subversion-tools

sudo apt-get install trac
sudo apt-get install trac-ja-resource

sudo apt-get install libapache2-mod-python
</pre>
</code>

<p>Apache を設定してやります。</p>

<code>
<pre>
sudo a2enmod mod_python
sudo a2enmod rewrite
</pre>
</code>

<h4 class="contentsSubTitle">Subversion と Trac の設定</h4>

<p>Subversion のレポジトリの作成を行います。</p>

<code>
<pre>
sudo mkdir /var/svn/
sudo chown -R www-data /var/svn/
sudo svnadmin create /var/svn/public
</pre>
</code>

<p>あとでバーチャルホスト設定するので、WEB 用にあわせてディレクトリを作成し、Trac を初期化します。</p>

<code>
<pre>
sudo mkdir -p /www/sites/trac.weeeblog.net/htdocs
sudo trac-admin /www/sites/trac.weeeblog.net/htdocs/public initenv
sudo chown -R www-data:www-data /www/sites/trac.weeeblog.net/htdocs/public
</pre>
</code>

<p>trac-admin コマンドのときに、いくつか質問が来ます。</p>

<code>
<pre>
Project Name [My Project]&gt; Weeeblog.net Trac
Database connection string [sqlite:db/trac.db]&gt; 
Repository type [svn]&gt; 
Path to repository [/path/to/repos]&gt; /var/svn/public
Templates directory [/usr/share/trac/templates]&gt; 
</pre>
</code>

<p>権限設定を行います。</p>

<code>
<pre>
sudo trac-admin /www/sites/trac.weeeblog.net/htdocs/public permission remove anonymous  REPORT_DELETE WIKI_CREATE WIKI_MODIFY REPORT_SQL_VIEW TICKET_APPEND TICKET_CHGPROP TICKET_CREATE TICKET_MODIFY
sudo trac-admin /www/sites/trac.weeeblog.net/htdocs/public permission add okayama BROWSER_VIEW CHANGESET_VIEW CONFIG_VIEW FILE_VIEW LOG_VIEW MILESTONE_ADMIN MILESTONE_CREATE MILESTONE_DELETE MILESTONE_MODIFY MILESTONE_VIEW REPORT_ADMIN REPORT_CREATE REPORT_DELETE REPORT_MODIFY REPORT_SQL_VIEW REPORT_VIEW ROADMAP_ADMIN ROADMAP_VIEW SEARCH_VIEW TICKET_ADMIN TICKET_APPEND TICKET_CHGPROP TICKET_CREATE TICKET_MODIFY TICKET_VIEW TIMELINE_VIEW TRAC_ADMIN WIKI_ADMIN WIKI_CREATE WIKI_DELETE WIKI_MODIFY WIKI_VIEW
</pre>
</code>

<p>テンプレート関連のロードとかコピーとかを行います。</p>

<code>
<pre>
sudo trac-admin /www/sites/trac.weeeblog.net/htdocs/public wiki load /usr/share/trac-ja-resource/wiki-default
sudo cp /usr/share/trac-ja-resource/templates/* /www/sites/trac.weeeblog.net/htdocs/public/templates/
</pre>
</code>

<p>ファイルがそろったら、それらに対して権限設定してやります。</p>

<code>
<pre>
sudo chown -R www-data:www-data /www/sites/trac.weeeblog.net/htdocs/public
</pre>
</code>

<p>設定ファイルを確認します。</p>

<code>
<pre>
sudo vi /www/sites/trac.weeeblog.net/htdocs/public/conf/trac.ini
</pre>
</code>

<code>
<pre class="withScrl">
# -*- coding: utf-8 -*-

[attachment]
max_size = 262144
render_unsafe_content = false

[browser]
downloadable_paths = /trunk, /branches/*, /tags/*
hide_properties = svk:merge
render_unsafe_content = false

[changeset]
max_diff_bytes = 10000000
max_diff_files = 0
wiki_format_messages = true

[header_logo]
alt = 
height = -1
link = http://trac.weeeblog.net/ &lt;&lt; これ
src = common/trac_banner.png
width = -1

[logging]
log_file = trac.log
# log_format = &lt;set in global trac.ini&gt;
log_level = DEBUG
log_type = none

[mimeviewer]
enscript_modes = text/x-dylan:dylan:4
enscript_path = enscript
max_preview_size = 262144
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
php_path = php
silvercity_modes = 
tab_width = 8

[notification]
always_notify_owner = false
always_notify_reporter = false
always_notify_updater = true
mime_encoding = base64
smtp_always_bcc = 
smtp_always_cc = 
smtp_default_domain = 
smtp_enabled = false
smtp_from = trac@localhost
smtp_password = 
smtp_port = 25
smtp_replyto = trac@localhost
smtp_server = localhost
smtp_subject_prefix = __default__
smtp_user = 
use_public_cc = false
use_short_addr = false
use_tls = false

[project]
descr = My example project
footer = Visit the Trac open source project at&lt;br /&gt;&lt;a href=&quot;http://trac.edgewall.org/&quot;&gt;http://trac.edgewall.org/&lt;/a&gt;
icon = common/trac.ico
name = Weeeblog.net Trac &lt;&lt; 質問の答え
url = http://trac.weeeblog.net/ &lt;&lt; これ

[search]
min_query_length = 3

[ticket]
default_component = 
default_milestone = 
default_priority = major
default_type = defect
default_version = 
restrict_owner = false

[timeline]
changeset_long_messages = false
changeset_show_files = 0
default_daysback = 30
ticket_show_details = false

[trac]
authz_file = 
authz_module_name = 
base_url = 
check_auth_ip = true
database = sqlite:db/trac.db
default_charset = iso-8859-15
default_handler = WikiModule
htdocs_location = 
ignore_auth_case = false
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
metanav = login,logout,settings,help,about
permission_store = DefaultPermissionStore
repository_dir = /var/svn/public &lt;&lt; 質問の答え
repository_type = svn
# request_filters = &lt;set in global trac.ini&gt;
# templates_dir = &lt;set in global trac.ini&gt;
timeout = 20

[wiki]
ignore_missing_pages = false
render_unsafe_content = false
split_page_names = false
</pre>
</code>

<h4 class="contentsSubTitle">バーチャルホストと WEB 設定</h4>

<p>ログインに使用するベーシック認証のための .htpasswd を作成します。</p>

<code>
<pre>
sudo mkdir /var/trac
sudo htpasswd -c /var/trac/.htpasswd okayama
</pre>
</code>

<p>ドキュメントルートを見せる必要がない場合はリダイレクト設定をしておきます。</p>

<code>
<pre>
sudo vi /www/sites/trac.weeeblog.net/htdocs/.htaccess
</pre>
</code>

<code>
<pre>
RewriteEngine on
RewriteRule ^$ /public
</pre>
</code>


<p>無限ループを避けるためにリダイレクト先では切っておく</p>

<code>
<pre>
sudo vi /www/sites/trac.weeeblog.net/htdocs/public/.htaccess
</pre>
</code>

<code>
<pre>
RewriteEngine Off
</pre>
</code>

<p>シンボリックリンクを張る</p>

<code>
<pre>
cd /www/sites/trac.weeeblog.net/htdocs
sudo ln -s /usr/share/trac/cgi-bin/trac.cgi
</pre>
</code>

<p>バーチャルホスト設定ファイルを作成します。</p>

<code>
<pre>
sudo vi /etc/apache2/sites-enabled/trac.weeeblog.net
</pre>
</code>

<code>
<pre>
&lt;virtualHost *&gt;
    ServerName trac.weeeblog.net
    DocumentRoot /www/sites/trac.weeeblog.net/htdocs

    ErrorLog /www/sites/trac.weeeblog.net/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel info

    CustomLog /www/sites/trac.weeeblog.net/access.log combined
    ServerSignature On

    &lt;Location /&gt;
        AddType application/x-httpd-cgi .cgi
        AddType application/x-httpd-php .php .phtml .php3
        AddType application/x-httpd-php-source .phps
        DirectoryIndex index.phtml index.fcgi index.html index.cgi index.pl index.php index.xhtml

        Options ExecCGI +Indexes FollowSymLinks MultiViews
#        AllowOverride None
        Order allow,deny
        allow from all
        
        # Trac need to know where the database is located
        SetEnv TRAC_ENV /www/sites/trac.weeeblog.net/htdocs

        SetHandler    mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption  TracEnvParentDir /www/sites/trac.weeeblog.net/htdocs
        PythonOption  TracUriRoot      /
    &lt;/Location&gt;

    &lt;locationMatch &quot;/[[:alnum:]]+/login&quot;&gt;
        AuthType Basic
        AuthName &quot;trac&quot;
        AuthUserFile /var/trac/.htpasswd
        Require valid-user
    &lt;/locationMatch&gt;

&lt;/virtualHost&gt;
</pre>
</code>


<p>バーチャルホスト設定を書いたら、再起動して WEB アクセスします。</p>

<code>
<pre>
sudo /etc/init.d/apache2 restart
</pre>
</code>

<h4 class="contentsSubTitle"><abbr title="Advanced Micro Devices Inc">AMD</abbr> 64 で発生するエラーについて</h4>

<p>clearsilver がインストールされていないエラーが出た場合、以下のようにしてインストールします。</p>

<code>
<pre>
sudo apt-get build-dep python-clearsilver
sudo apt-get install python-dev
cd /usr/local/src
sudo wget http://www.clearsilver.net/downloads/clearsilver-0.10.4.tar.gz
sudo tar xzvf clearsilver-0.10.4.tar.gz
cd clearsilver-0.10.4
sudo ./configure --with-python=/usr/bin/python2.5
sudo make
sudo make install
</pre>
</code>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、Webmin をインストールする</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_1845.php" />
    <id>tag:mtos.weeeblog.net,2008://1.676</id>

    <published>2008-07-20T09:45:16Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアA...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="webmin" label="Webmin" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>※ 今回構築中のマシンは、<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。</p>

<p>Webmin 専用にバーチャルホストを設定し、ブラウザで操作するように設定します。</p>

<h4 class="contentsSubTitle">スーパーユーザのパスワード設定</h4>

<p>前もってスーパーユーザにパスワード設定してやります。Ubuntu は基本的に sudo でコマンドを実行していきますが、Webmin は root で動かしてやる必要があるためです。(<a href="http://old.ubuntulinux.jp/Members/co/ubuntuwebmin/" target="_blank">この wiki</a> が参考になりました)</p>

<code>
<pre>
sudo su
passwd
</pre>
</code>

<p>で、root に対してパスワードを設定することができます。※ でも、後で設定しても大丈夫のようです</p>

<h4 class="contentsSubTitle">Ubuntu Server Edition への Webmin のインストール</h4>

<p>まず、パッケージをダウンロードします。</p>

<code>
<pre>
cd /usr/local/src
sudo wget 'http://prdownloads.sourceforge.net/webadmin/webmin_1.400_all.deb'
</pre>
</code>

<p>そのままインストールすると依存関係のエラーが出るので、先に必要なものを入れておきます。</p>

<code>
<pre>
sudo apt-get install libnet-ssleay-perl
sudo apt-get install libauthen-pam-perl
sudo apt-get install libio-pty-perl
sudo apt-get install libmd5-perl
</pre>
</code>

<p>全部そろったらインストールします。</p>

<code>
<pre>
sudo dpkg -i webmin_1.400_all.deb
</pre>
</code>

<p>もし、先にインストールを行ってしまい、依存関係エラーが発生した場合は、以下のコマンドでいったん webmin を削除してください。</p>

<code>
<pre>
sudo dpkg -r webmin
</pre>
</code>

<h4 class="contentsSubTitle">バーチャルホストの設定</h4>

<code>
<pre>
sudo mkdir -p /www/sites/webmin.weeeblog.net/htdocs
sudo chown -R www-data:www-data /www/sites/webmin.weeeblog.net/htdocs
sudo vi /etc/apache2/sites-enabled/webmin.weeeblog.net
</pre>
</code>

<p>公開用ディレクトリを作成し、権限設定ののち、apache のバーチャルホスト設定ファイルを作成します。</p>

<code>
<pre>
NameVirtualHost *:10000
&lt;virtualHost *:10000&gt;
    ServerName webmin.weeeblog.net
    DocumentRoot /www/sites/webmin.weeeblog.net/htdocs

    ErrorLog /www/sites/webmin.weeeblog.net/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel info

    CustomLog /www/sites/webmin.weeeblog.net/access.log combined
    ServerSignature On

    Alias / /usr/share/webadmin/

    &lt;Location /&gt;
        AddType application/x-httpd-cgi .cgi
        AddType application/x-httpd-php .php .phtml .php3
        AddType application/x-httpd-php-source .phps
        DirectoryIndex index.phtml index.fcgi index.html index.cgi index.pl index.php index.xhtml

        Options ExecCGI +Indexes FollowSymLinks MultiViews
#        AllowOverride None
        Order allow,deny
        allow from all
    &lt;/Location&gt;
&lt;/virtualHost&gt;
</pre>
</code>

<p>Alias をつけといてやることで、ファイルをコピーしたりする手間が省けるので少し楽。また、アクセス制限は適宜行ってください。</p>

<p>バーチャルホスト設定を書いたら、再起動して WEB アクセスしてみる。</p>

<code>
<pre>
sudo /etc/init.d/apache2 restart
</pre>
</code>

<p><abbr title="HyperText Transfer Protocol Secure">HTTPS</abbr> で接続し(さらに上記バーチャルホスト設定の場合はポート 10000 でアクセス)、オレオレ証明書を受け入れ、ログインして日本語に設定を変更します。</p>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、phpPgAdmin をインストールする</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_1821.php" />
    <id>tag:mtos.weeeblog.net,2008://1.677</id>

    <published>2008-07-20T09:21:01Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアA...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="phppgadmin" label="phpPgAdmin" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>※ 今回構築中のマシンは、<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。</p>

<p>phpPgAdmin 専用にバーチャルホストを設定し、ブラウザで操作するように設定します。</p>

<h4 class="contentsSubTitle">Ubuntu Server Edition への phpPgAdmin のインストール</h4>

<code>
<pre>
sudo apt-get install phppgadmin
</pre>
</code>

<p>でインストールできます。</p>



<h4 class="contentsSubTitle">バーチャルホスト設定</h4>

<code>
<pre>
sudo mkdir -p /www/sites/postgre.weeeblog.net/htdocs
sudo chown -R www-data:www-data /www/sites/postgre.weeeblog.net/htdocs
sudo vi /etc/apache2/sites-enabled/postgre.weeeblog.net
</pre>
</code>

<p>公開用ディレクトリを作成し、権限設定ののち、apache のバーチャルホスト設定ファイルを作成します。</p>

<code>
<pre>
&lt;virtualHost *&gt;
    ServerName postgre.weeeblog.net
    DocumentRoot /www/sites/postgre.weeeblog.net/htdocs

    ErrorLog /www/sites/postgre.weeeblog.net/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel info

    CustomLog /www/sites/postgre.weeeblog.net/access.log combined
    ServerSignature On

    # phpMyAdmin default Apache configuration

    Alias / /usr/share/phppgadmin/

    &lt;DirectoryMatch /usr/share/phppgadmin/&gt;
        DirectoryIndex index.php
        
        Options +FollowSymLinks
        AllowOverride None
        
#        order deny,allow
#        deny from all
#        allow from 127.0.0.0/255.0.0.0
        # allow from all
        &lt;IfModule mod_php4.c&gt;
          php_flag magic_quotes_gpc Off
          php_flag track_vars On
          php_flag register_globals On
          php_value include_path .
        &lt;/IfModule&gt;
        &lt;IfModule mod_php5.c&gt;
          php_flag magic_quotes_gpc Off
          php_flag track_vars On
          php_flag register_globals On
          php_value include_path .
        &lt;/IfModule&gt;
    &lt;/DirectoryMatch&gt;
&lt;/virtualHost&gt;
</pre>
</code>

<p>Alias をつけといてやることで、ファイルをコピーしたりする手間が省けるので少し楽。また、ここでは必要ないのでコメントアウトしていますが、アクセス制限は適宜行ってください。</p>

<p>バーチャルホスト設定を書いたら、再起動して WEB アクセスしてみる。</p>

<code>
<pre>
sudo /etc/init.d/apache2 restart
</pre>
</code>

<h4 class="contentsSubTitle">PostgreSQL のユーザ設定</h4>

<p>WEB アクセスはできるものの、そのままではログインできないので、ログイン用のユーザを作成します。</p>

<code>
<pre>
sudo passwd postgres
su - postgres
</pre>
</code>

<p>で、ユーザ postgre にパスワードを設定し、ユーザ postgre になる。</p>

<code>
<pre>
createuser -P postgreuser
> Enter password for new role: 
> Shall the new role be a superuser? (y/n) y
</pre>
</code>

<p>とし、ユーザ postgreuser を作成すれば、phpPgAdmin に postgreuser としてログインできるようになります。</p>

<p>ちなみに、パスワードを設定したユーザ postgres でログインしようとしても、「ログインが許可されませんでした。」と言われてログインできません。</p>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、phpMyAdmin をインストールする</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_1751.php" />
    <id>tag:mtos.weeeblog.net,2008://1.678</id>

    <published>2008-07-20T08:51:04Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアA...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="phpmyadmin" label="phpMyAdmin" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>※ 今回構築中のマシンは、<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。</p>

<p>phpMyAdmin 専用にバーチャルホストを設定し、ブラウザからデータベースを操作できるように設定します。</p>

<h4 class="contentsSubTitle">Ubuntu Server Edition への phpMyAdmin のインストール</h4>

<code>
<pre>
sudo apt-get install phpmyadmin
</pre>
</code>

<p>でインストールできます。「自動的に再設定する web サーバ:」を聞かれるので「apache2」を選択します。</p>

<h4 class="contentsSubTitle">バーチャルホスト設定</h4>

<code>
<pre>
sudo mkdir -p /www/sites/mysql.weeeblog.net/htdocs
sudo chown -R www-data:www-data /www/sites/mysql.weeeblog.net/htdocs
sudo vi /etc/apache2/sites-enabled/mysql.weeeblog.net
</pre>
</code>

<p>公開用ディレクトリを作成し、権限設定ののち、apache のバーチャルホスト設定ファイルを作成します。</p>


<code>
<pre>
&lt;virtualHost *&gt;
    ServerName mysql.weeeblog.net
    DocumentRoot /www/sites/mysql.weeeblog.net/htdocs

    ErrorLog /www/sites/mysql.weeeblog.net/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel info

    CustomLog /www/sites/mysql.weeeblog.net/access.log combined
    ServerSignature On

    # phpMyAdmin default Apache configuration

    Alias / /usr/share/phpmyadmin/

    &lt;Directory /usr/share/phpmyadmin&gt;
        Options Indexes FollowSymLinks
        DirectoryIndex index.php

        # Authorize for setup
        &lt;Files setup.php&gt;
            # For Apache 1.3 and 2.0
            &lt;IfModule mod_auth.c&gt;
            AuthType Basic
            AuthName &quot;phpMyAdmin Setup&quot;
            AuthUserFile /etc/phpmyadmin/htpasswd.setup
            &lt;/IfModule&gt;
            # For Apache 2.2
            &lt;IfModule mod_authn_file.c&gt;
            AuthType Basic
            AuthName &quot;phpMyAdmin Setup&quot;
            AuthUserFile /etc/phpmyadmin/htpasswd.setup
            &lt;/IfModule&gt;
            Require valid-user
        &lt;/Files&gt;
        &lt;IfModule mod_php4.c&gt;
            AddType application/x-httpd-php .php

            php_flag magic_quotes_gpc Off
            php_flag track_vars On
            php_flag register_globals Off
            php_value include_path .
        &lt;/IfModule&gt;
        &lt;IfModule mod_php5.c&gt;
            AddType application/x-httpd-php .php

            php_flag magic_quotes_gpc Off
            php_flag track_vars On
            php_flag register_globals Off
            php_value include_path .
        &lt;/IfModule&gt;
    &lt;/Directory&gt;
&lt;/virtualHost&gt;
</pre>
</code>

<p>Alias をつけといてやることで、ファイルをコピーしたりする手間が省けるので少し楽。また、アクセス制限は適宜行ってください。</p>

<p>バーチャルホスト設定を書いたら、再起動して WEB アクセスしてみる。</p>

<code>
<pre>
sudo /etc/init.d/apache2 restart
</pre>
</code>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、ProFTP をインストールする</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_1739.php" />
    <id>tag:mtos.weeeblog.net,2008://1.679</id>

    <published>2008-07-20T08:39:02Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアA...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="proftp" label="ProFTP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>※ 今回構築中のマシンは、<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。</p>

<h4 class="contentsSubTitle">Ubuntu Server Edition への ProFTP のインストール</h4>

<p>Server Edition を セットアップする際に、LAMP 環境はインストールすることができますが、<abbr title="File Transfer Protocol">FTP</abbr> 接続することができません(<abbr title="Secure File Transfer Program">SFTP</abbr> 接続はできますが)。</p>

<p>なので、<abbr title="File Transfer Protocol">FTP</abbr> でも接続できるよう、ProFTP をインストールします。</p>

<p><code><br />
<pre><br />
sudo apt-get install proftpd<br />
</pre><br />
</code></p>

<p>今回は、standalone を選択しました。</p>

<p>とりあえず、これで root ユーザでの <abbr title="File Transfer Protocol">FTP</abbr> 接続ができるようになります。適宜、接続ユーザを作成してください。</p>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition に、デスクトップ版のグラフィカルな UI を載せる</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_1632.php" />
    <id>tag:mtos.weeeblog.net,2008://1.680</id>

    <published>2008-07-20T07:32:22Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアA...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="gui" label="GUI" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>※ 今回構築中のマシンは、<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。</p>

<h4 class="contentsSubTitle">Ubuntu Server Edition への <abbr title="Graphical User Interface">GUI</abbr> のインストール</h4>

<p>Ubuntu Server Edition はテキストのみの CUI で、それはサーバとしての動作のことを考えてのことだと思うし、Server Edition だとセットアップの時に LAMP 環境なんかもまとめてインストールできるから楽なのですが、デスクトップ版のグラフィカルな <abbr title="User Interface">UI</abbr> や、愛嬌あるロゴも好きなので、やっぱり <abbr title="Graphical User Interface">GUI</abbr> も入れておくことにしました。</p>

<p>Server Edition のセットアップが終わった後で、</p>

<code>
<pre>
sudo apt-get install ubuntu-desktop
</pre>
</code>

<p>を実行するだけ。Server Edition のセットアップの後でこれを行うことで、LAMP 環境がインストールされたデスクトップ版見たいな感じにできるので便利です。</p>

<p>ただし、1.7 GB くらい必要です。さすがにちょっと時間かかります。インストールが終わったら、</p>

<code>
<pre>
sudo reboot now
</pre>
</code>

<p>で再起動しましょう。</p>]]>
        
    </content>
</entry>

<entry>
    <title>Ubuntu 8.04 LTS(Hardy Heron) Server Edition をセットアップする</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/07/20_1631.php" />
    <id>tag:mtos.weeeblog.net,2008://1.681</id>

    <published>2008-07-20T07:31:36Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>※ 今回構築中のマシンは、DELL PowerEdge T105(クアッドコアA...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="lamp" label="LAMP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="server" label="Server" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="setup" label="Setup" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p>※ 今回構築中のマシンは、<a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">DELL PowerEdge T105(クアッドコア<abbr title="Advanced Micro Devices Inc">AMD</abbr> Opteron 1352)</a> です。</p>

<h4 class="contentsSubTitle">Ubuntu のインストール CD を作成する</h4>

<p><a href="http://www.ubuntu.com/getubuntu/download" target="_blank">Ubuntu の公式サイトのダウンロードページ</a>から <abbr title="International Organization for Standardization">ISO</abbr> イメージファイルをダウンロードして、インストール CD を作成します(※ 今回は <a href="http://www1.jp.dell.com/content/products/productdetails.aspx/pedge_t105?c=jp&cs=jpbsd1&l=ja&s=bsd" target="_blank">PowerEdge T105</a> なので、<abbr title="Advanced Micro Devices Inc">AMD</abbr> 64 を選択する必要がありました)。</p>

<p>Mac OSX の場合、空の CD をドライブに入れて、</p>

<pre>
アプリケーション => ユーティリティ => ディスクユーティリティ => ディスクを作成
</pre>

<p>で、<abbr title="International Organization for Standardization">ISO</abbr> イメージファイルを選択すれば作成できます。</p>

<h4 class="contentsSubTitle">Ubuntu Server Edition をインストールする</h4>

<p>CD をドライブに入れて、再起動する。の起動画面で F11(Boot Menu) を選択します。Optical Drive(CD が入っているドライブ) から Boot させて、「Language」で、「日本語」を選択すると、セットアップが始まります。</p>

<p>「Method for toggling between national and Latin mode」の選択は、デフォルトでかまいません。僕の場合は「Alt+Shift」を選択。</p>

<p>「ホスト名」は、デフォルトで「ubuntu」が入っていたのでそのままにしました。ubuntu サーバを自宅にたくさん置く予定などないし。</p>

<p>「パーティショニングの方法」は、「ガイド - ディスク全体を使う」を選択。僕は自分のサーバの構築の際は、必ず全部まっさらにしてやるようにしています。</p>

<p>パーティショニング対象のディスクを選択し、「変更を書き込む」。</p>

<p>「新しいユーザの本名(フルネーム)」に、「okayama」。<br />
「あなたのアカウントのユーザ名」にも、「okayama」。<br />
なぜフルネームを入れなきゃいけないんだろう。</p>

<p>パスワード入力し、リタイプします。こういうとき、テンキーを使って Num Lock されていたとかされていなかったとかでトラブったことがあるので、テンキーは使わない。</p>

<p>「<abbr title="HyperText Transfer Protocol">HTTP</abbr> プロキシの情報(なければ空)」は、ないので空。</p>

<p>「Choose software to install」は、とりあえず全部入れました。とりあえず WEB サーバを構築するだけなら、LAMP Server と OpenSSH Server くらいがあれば十分ですが、後から必要になったら面倒なので。</p>

<p>「MySQL の "root" ユーザに対する新しいパスワード」を入力。リタイプします。</p>

<p>「メール設定の一般形式」は、「インターネットサイト」を選択。「システムメール名」は「ubuntu」にしておきました。なぜって、そこにそれが入力されていたからさ。</p>

<p>ここまで終わると、CD ドライブが出てくるので、CD を取り出して再起動。早い。</p>

<p>ここからは <abbr title="Secure Shell">SSH</abbr> ログインして作業することになります。いや、直接やってもいいですけど</p>

<h4 class="contentsSubTitle">※ Mac OSX で <abbr title="Secure Shell">SSH</abbr> ログインしようとすると発生することがある警告</h4>

<p>作ったり潰したりしている時なんですが、<abbr title="Secure Shell">SSH</abbr> ログインしようとすると、 </p>

<code>
<pre>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# その他ごちゃごちゃ
</pre>
</code>

<p>というエラーが出ます。これはまあ、文字通り接続しようとしているリモートホスト(サーバ)が今までと違うみたいだよっていう警告。</p>

<code>
<pre>
sudo vi /Users/okayama/.ssh/known_hosts
</pre>
</code>

<p>で、該当する <abbr title="Internet Protocol">IP</abbr> のところを削除してやれば、それ以降は警告が出なくなります。(<a href="http://misfits.wordpress.com/2007/04/22/osx%E3%81%AE%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%A7%E3%83%AA%E3%83%A2%E3%83%BC%E3%83%88%E3%83%9B%E3%82%B9%E3%83%88%E3%81%AB%E6%8E%A5%E7%B6%9A%E3%81%A7%E3%81%8D%E3%81%AA%E3%81%84/" target="_blank">この記事</a>が参考になりました)</p>

<p>とりあえずこれでセットアップは完了。</p>]]>
        
    </content>
</entry>

<entry>
    <title>MT::App::CMS::template_source.*** でデフォルトのテンプレートと自前で用意したテンプレートファイルの内容を差し替える場合はこんなふうに書くとソースが短くなる</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/06/28_0043.php" />
    <id>tag:mtos.weeeblog.net,2008://1.682</id>

    <published>2008-06-27T15:43:40Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary> sub _cb_template_source {     my ( $cb,...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="callback" label="Callback" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="movabletype" label="Movable Type" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mtappcmstemplate_source" label="MT::App::CMS::template_source" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<code>
<pre>
sub _cb_template_source {
    my ( $cb, $app, $tmpl ) = @_;
    my $method = $cb-&gt;method;
    if ($method =~ /<abbr title="Movable Type">MT</abbr>::App::<abbr title="Content Management System">CMS</abbr>::template_source\.(.*)/) {
        my $plugin_tmpl = File::Spec-&gt;catdir( $plugin-&gt;path, 'alt-tmpl', $1 . '.tmpl' );
        my $src = _read_file( $plugin_tmpl ) if ( -e $plugin_tmpl );
        if ( $src ) {
            $src =~ s/&lt;__plugintrans phrase=&quot;(.*?)&quot;&gt;/$plugin-&gt;translate($1)/eg;
            $$tmpl = $src;
        }
    }
}
</pre>
</code>

<p>$cb-&gt;method; で <abbr title="Movable Type">MT</abbr>::App::<abbr title="Content Management System">CMS</abbr>::template_source.テンプレート名 が得られるので、そこから正規表現でテンプレート名を取り出し、プラグインを格納しているフォルダ内の alt-tmpl に入れた同名のファイルと差し替える処理。丸ごと書き換えられてしまうので、他にもプラグインで似たようなことをしている場合は注意が必要ですが、<abbr title="Practical Extraction and Report Language">Perl</abbr> は正規表現よりも eq とか ne とかで比較するとか、直接代入するとかの方が処理が早いので、個人的には正規表現で transform するよりもこのようにする方が好きです(ファイル読み込み処理が入ってるから、むしろ重いかもしれないけど、なんとなく習慣として…)。このようにして、例えばテンプレート名で分岐とかすれば、ひとつのルーチンですべてのコールバック定義をまかなえたりします。ただし、コードの視認性は保証しませんYO</p>

<p>このようにファイルの内容と本来のテンプレートの内容を入れ替えてしまう場合、 &lt;__trans phrase=&quot;***&quot;&gt; でプラグインによってローカライズしようとしても効かないので、これは置換で行うようにしています。その際、プラグインのローカライズファイルで定義するものと、<abbr title="Movable Type">MT</abbr> 本来のローカライズとを区別しておかないとならないので、 __trans を __plugintrans としました。</p>

<p>_read_file ルーチンは独自に定義している、使い慣れたファイル読み込みルーチンなのだけれど、このくらいは <abbr title="Movable Type">MT</abbr> の <abbr title="Application Programming Interface">API</abbr> にあるんじゃないかなと思います(探してません)。wantarray の場合は各行を要素とする配列を返し、そうでない場合は全行をまとめて変数として返します。</p>

<code>
<pre>
sub _read_file {
    my $file_path = shift;
    if ($file_path) {
        open (FH, $file_path);
        if (wantarray) {
            my @lines = &lt;FH&gt;;
            close FH;
            return @lines if (@lines);
        } else {
            my $str;
            while ( my $line = &lt;FH&gt;) {
                $str .= $line;
            }
            close FH;
            return $str if ($str);
        }
    }
}
</pre>
</code>

<p><a href="/logs/2008/06/21_1347.php" target="_blank">前回の記事</a>が長かったので、今回はこのへんで…</p>]]>
        
    </content>
</entry>

<entry>
    <title>MT::Boostrap を利用して独自アプリケーションを作成する場合には、MT::Comments のソースが結構役に立つ</title>
    <link rel="alternate" type="text/html" href="http://weeeblog.net/logs/2008/06/21_1347.php" />
    <id>tag:mtos.weeeblog.net,2008://1.683</id>

    <published>2008-06-21T04:47:22Z</published>
    <updated>2008-08-16T08:20:03Z</updated>

    <summary>A-From を公開している ARK-Web の進地さんが毎週金曜日の午前 10...</summary>
    <author>
        <name>okayama</name>
        
    </author>
    
    <category term="applications" label="Applications" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="movabletype" label="Movable Type" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="mtappcomments" label="MT::App::Comments" scheme="http://www.sixapart.com/ns/types#tag" />
    
    
    <content type="html" xml:lang="en" xml:base="http://weeeblog.net/">
        <![CDATA[<p><a href="http://www.ark-web.jp/movabletype/" target="_blank">A-From</a> を公開している ARK-Web の進地さんが毎週金曜日の午前 10:30 から開催してらっしゃる <a href="http://www.ark-web.jp/sandbox/wiki/?FrontPage" target="_blank"><abbr title="Movable Type">MT</abbr> プラグイン勉強会</a> のストリーミングを見るのが最近の週末の日課(もっと言えばささやかな現実逃避)になっています。</p>

<p>ここ何週間かは「<a href="http://www.ark-web.jp/sandbox/wiki/?Movable%20Type%2F%C2%E8%A3%B5%B2%F3MT%A5%D7%A5%E9%A5%B0%A5%A4%A5%F3%CA%D9%B6%AF%B2%F1%20-%20Bootsrap%A4%F2%BB%C8%A4%C3%A4%BF%C6%C8%BC%ABCGI%A4%CE%BA%EE%C0%AE" target="_blank"><abbr title="Movable Type">MT</abbr>::Boostrap を利用して独自アプリケーションを作成する</a>」ことがテーマなのですが、何度かこういったアプリケーションを作成していて気がついた点、役に立ちそうな点をまとめてみます。</p>

<h4 class="contentsSubTitle">独自(?)アプリケーションの代表はやっぱりコメント投稿</h4>

<p>Movable Type の外から(実際には「外」ではないのですが) Movable Type のライブラリを利用した <abbr title="Common Gateway Interface">CGI</abbr> アプリケーションを作成する場合、コメント投稿の際の動作を定義しているソースコードが役立ちます。この、コメント投稿に関するスクリプトは、「<abbr title="Movable Type">MT</abbr>を格納しているディレクトリ/lib/<abbr title="Movable Type">MT</abbr>/App/Comments.pm」に記述されています。</p>

<h4 class="contentsSubTitle">初期化処理</h4>

<p>初期化処理には、アプリケーションの初期化である init ルーチン(メソッド)と、リクエストの初期化である init_request ルーチン(メソッド)の二つがあります。公開されているアプリケーションでは、init_request でメソッドの追加を行っているものが多いですが、Comments.pm では init の方でメソッドの追加を行っています。Comments.pm の該当箇所は以下です。</p>

<code>
<pre class="withScrl">
sub init {
    my $app = shift;
    $app-&gt;SUPER::init(@_) or return;
    $app-&gt;add_methods(
        login            =&gt; \&amp;login,
        login_external   =&gt; \&amp;login_external,
        do_login         =&gt; \&amp;do_login,
        signup           =&gt; \&amp;signup,
        do_signup        =&gt; \&amp;do_signup,
        register         =&gt; \&amp;register,
        do_register      =&gt; \&amp;do_register,
        preview          =&gt; \&amp;preview,
        post             =&gt; \&amp;post,
        handle_sign_in   =&gt; \&amp;handle_sign_in,
        cmtr_name_js     =&gt; \&amp;commenter_name_js,
        edit_profile     =&gt; \&amp;edit_commenter_profile,
        save_profile     =&gt; \&amp;save_commenter_profile,
        red              =&gt; \&amp;do_red,
        generate_captcha =&gt; \&amp;generate_captcha,
    );
    $app-&gt;{template_dir} = 'comment';
    $app-&gt;init_commenter_authenticators;
    $app-&gt;init_captcha_providers();
    $app;
}

sub init_request {
    my $app = shift;
    $app-&gt;SUPER::init_request(@_);
    $app-&gt;set_no_cache;
    $app-&gt;{default_mode} = 'post';
    my $q = $app-&gt;param;

 