4: 2008-08-31 (日) 21:38:09 なーお  |
現: - no date -  |
| - | *xwordsモジュールで、d3コメント統合 [#wdc2d396] | |
| - | **概要 [#p71ef8bd] | |
| - | 以前より、[[Xwordsモジュール:http://www.kanpyo.net/xoopscube+index.htm]] をコメント統合で使ってはいましたが、携帯用テンプレートの共有化を行う際に、テンプレートにサイト毎に異なるd3forum_dirnameとforum_idを記述する部分で支障があり、何とかしたいと考え、Xwords-ver0.46をベースに手を入れてみました。 | |
| | | | |
| - | + D3コメントクラスは、公開専用です。 一応、こんな風に表示されます。 | |
| - | &ref(xwords_d3com_class.gif,mw:240,mh:240); | |
| - | &br; | |
| - | + コメント統合先のd3forumディレクトリ名・フォーラムid値は、d3blogのコメント統合を参考に、Xwordsの管理画面でmodule_configに保存する方式としました。 そして、コメント統合のクラスはd3forum-0.83a以降で実装された新方式(「d3comment」で呼ぶほう)を採用しています。 また、D3commentクラス内でforum_idまで認識するため、テンプレート内に記述する必要がありません。 | |
| - | こうすることで、複数サイトを共有化している場合でも、携帯用のテンプレートを共通化できますし、テンプレート配布の際にも神経を使わずに済みます。&br;&br; | |
| - | | |
| - | **手順と方法 [#hbc1b43a] | |
| - | テンプレートだけでなく、ソースの変更も必要ですので、細かく記しておきます。 | |
| - | | |
| - | なお、個別のアップロードも編集も面倒、という人のために、Xwords-ver0.46との差分ファイルパックを、ここに置いておきます。 解凍後、夫々のフォルダに上書きアップロードして使えます。 | |
| - | |&ref(xwords046a2_diff.zip);| | |
| - | |(08/08/31:xwordsD3commentContent.class.php を変更| | |
| - | | |
| - | ***D3commentクラス [#a4512ba7] | |
| - | D3commentクラスは、下記ファイルをダウンロード後、「xwords/class」内にアップロードして使用します。 | |
| - | |&ref(xwordsD3commentContent.class_0.php);| | |
| - | |(08/08/31:用語の属性(html,smiley,xcodes,br)を引いてサニタイズ処理に反映するようにした| | |
| - | | |
| - | 当然ながら、d3forumの方にコメント統合用に掲示板を追加し、(必要があれば)過去のxoopsコメントをインポート後、「コメント統合時の参照方法」に | |
| - | xwords::xwordsD3commentContent | |
| - | と記載します。(最初の「xwords」の部分は、インストールディレクトリ名に合わせて変更します。) | |
| - | なお、&font(Red){d3forumは0.83a以降のバージョンが必須};で、D3commentの最新のAPIクラス群を忘れずにアップして下さい。 | |
| - | | |
| - | ***Xwordsソースの変更 [#h36e8b97] | |
| - | (以下、&font(Red){ver-a2までの情報};です。 ver-b以降の情報は、追って編集します。) | |
| - | 3つのソースファイルに手を入れます。 こんな方法で良いのか自信はありませんが、間違いではないと思うのでご勘弁。 :-D &br; | |
| - | | |
| - | ****xoops_version.php [#p028bd9f] | |
| - | 「xoops_version.php」を編集し、管理画面にmodule_config項目を追加します。 | |
| - | 下記の388~402行目を追記します。 | |
| - | #code(php,379-){{ | |
| - | $cf++; | |
| - | $modversion['config'][$cf]['name'] = 'blocksperpage'; | |
| - | $modversion['config'][$cf]['title'] = "_MI_{$MYDIRNAME}_BLOCKSPERPAGE"; | |
| - | $modversion['config'][$cf]['description'] = "_MI_{$MYDIRNAME}_BLOCKSPERPAGEDSC"; | |
| - | $modversion['config'][$cf]['formtype'] = 'select'; | |
| - | $modversion['config'][$cf]['valuetype'] = 'int'; | |
| - | $modversion['config'][$cf]['default'] = 5; | |
| - | $modversion['config'][$cf]['options'] = array( '0' => 0,'5' => 5, '10' => 10, '15' => 15, '20' => 20, '25' => 25, '30' => 30, '50' => 50 ); | |
| - | | |
| - | $cf++; | |
| - | $modversion['config'][$cf]['name'] = 'com_agent'; | |
| - | $modversion['config'][$cf]['title'] = "_MI_{$MYDIRNAME}_COM_AGENT"; | |
| - | $modversion['config'][$cf]['description'] = "_MI_XWORDS_COM_AGENTDSC"; | |
| - | $modversion['config'][$cf]['formtype'] = 'textbox'; | |
| - | $modversion['config'][$cf]['valuetype'] = 'text'; | |
| - | $modversion['config'][$cf]['default'] = ''; | |
| - | | |
| - | $cf++; | |
| - | $modversion['config'][$cf]['name'] = 'com_agent_forumid'; | |
| - | $modversion['config'][$cf]['title'] = "_MI_{$MYDIRNAME}_COM_AGENTID"; | |
| - | $modversion['config'][$cf]['description'] = "_MI_XWORDS_COM_AGENTIDDSC"; | |
| - | $modversion['config'][$cf]['formtype'] = 'textbox'; | |
| - | $modversion['config'][$cf]['valuetype'] = 'int'; | |
| - | $modversion['config'][$cf]['default'] = 0; | |
| - | | |
| - | | |
| - | // On Install | |
| - | if( ! empty( $_POST['fct'] ) && ! empty( $_POST['op'] ) && $_POST['fct'] == 'modulesadmin' && $_POST['op'] == 'install_ok' && $_POST['module'] != 'xwords' && $_POST['module'] == $mydirname && file_exists( XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/oninstall.inc.php" ) ) | |
| - | { | |
| - | include XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/oninstall.inc.php" ; | |
| - | } | |
| - | }} | |
| - | | |
| - | ****languages/japanese/modinfo.php [#hc5bf161] | |
| - | 「modinfo.php」を編集し、上の作業で追加した管理画面の項目に日本語テキストを追加します。 | |
| - | 以下の158~162行目を追記します。 | |
| - | | |
| - | #code(php,150-){{ | |
| - | //Names of Blocks and Block information | |
| - | define("_MI_{$MYDIRNAME}_ENTRIESNEW", "新着ブロック"); | |
| - | define("_MI_{$MYDIRNAME}_ENTRIESTOP", "人気ブロック"); | |
| - | define("_MI_{$MYDIRNAME}_RANDOMTERM", "ランダムブロック"); | |
| - | define("_MI_{$MYDIRNAME}_TERMINITIAL", "頭文字ブロック"); | |
| - | | |
| - | //define("_MI_{$MYDIRNAME}_NOTUJIS", "MYSQLの環境が default-character-set = %s です。<br />XOOPSを使用する上で支障があるかもしれません。"); | |
| - | | |
| - | define("_MI_{$MYDIRNAME}_COM_AGENT","コメントシステムの設定"); | |
| - | define("_MI_{$MYDIRNAME}_COM_AGENTDSC","d3forumのコメント統合機能を使用する場合は<br/>フォーラムのhtml側ディレクトリ名を指定します。<br/>xoopsコメントを使用する場合やコメント機能を無効にする場合は空欄です。"); | |
| - | | |
| - | define("_MI_{$MYDIRNAME}_COM_AGENTID","コメントのforum_id"); | |
| - | define("_MI_{$MYDIRNAME}_COM_AGENTIDDSC","コメント統合を選択した場合、forum_idを必ず指定してください。"); | |
| - | | |
| - | | |
| - | ?> | |
| - | }} | |
| - | | |
| - | ****header.php [#t0ee83bc] | |
| - | 「header.php」に、下記のように56~65行目を追記します。 | |
| - | module_config設定項目を、smarty変数でテンプレートに渡すために必要です。 | |
| - | #code(php,54-){{ | |
| - | $myts = & XwordsTextSanitizer::getInstance(); | |
| - | | |
| - | // モジュールID // added by naao | |
| - | $module_handler =& xoops_gethandler('module'); | |
| - | $this_module =& $module_handler->getByDirname($mydirname); | |
| - | $mid = $this_module->getVar('mid'); | |
| - | | |
| - | // モジュールconfig // added by naao | |
| - | $config_handler =& xoops_gethandler("config"); | |
| - | $mod_config = $config_handler->getConfigsByCat(0, $mid); | |
| - | $xoopsTpl->assign("moduleConfig", $mod_config); | |
| - | | |
| - | | |
| - | ?> | |
| - | }} | |
| - | | |
| - | ***テンプレートの編集 [#u06971d4] | |
| - | 続いて、テンプレートを1つ、Altsysなどで編集します。 | |
| - | | |
| - | ****xwords_entry.html [#k912f7b2] | |
| - | 「xwords_entry.html」の、105~125行目 を以下のように編集します。 | |
| - | | |
| - | #code(html,105-){{ | |
| - | <{if $moduleConfig.com_agent}> | |
| - | <{d3comment mydirname='xwords' id=$thisterm.id subject=$thisterm.term class="xwordsD3commentContent}> | |
| - | <{else}> | |
| - | <{* comment nav block *}> | |
| - | <{if $commentsnav}> | |
| - | <div style="clear:both;margin:0.1em 0em;padding:0em;"> | |
| - | <fieldset class="item" style="border:1px solid #778;margin:1em 0em;background-color:transparent;"> | |
| - | <legend class="itemHead"><{$lang_comment}></legend> | |
| - | <div style="margin:1em 0em;padding:0em;text-align:center;line-height:1.3em;"> | |
| - | <{$commentsnav}> | |
| - | <{$lang_notice}> | |
| - | <!-- start comments loop --> | |
| - | <{if $comment_mode == "flat"}> | |
| - | <{include file="db:system_comments_flat.html"}> | |
| - | <{elseif $comment_mode == "thread"}> | |
| - | <{include file="db:system_comments_thread.html"}> | |
| - | <{elseif $comment_mode == "nest"}> | |
| - | <{include file="db:system_comments_nest.html"}> | |
| - | <{/if}> | |
| - | <!-- end comments loop --> | |
| - | </div> | |
| - | </fieldset> | |
| - | </div> | |
| - | <{/if}> | |
| - | <{/if}> | |
| - | }} | |
| - | | |
| - | ***モバイル用テンプレート [#e746c0ad] | |
| - | モバイルテンプハウスで、[[作成・公開中:http://www.mc8.jp/HD/modules/xpwiki?Templates/xwords]]。 | |
| - | | |
| - | **インストールと設定 [#k0c51a9a] | |
| - | xoops管理画面の「モジュールの管理」で、''&font(Maroon){「xwords」をモジュールアップデート};''します。 これで、「xwords」の管理画面に、2つの項目が追加されます。 | |
| - | | |
| - | &ref(xwords_config.gif,mw:240,mh:240); | |
| - | | |
| - | ここで、 | |
| - | +コメントシステムの設定 : d3forumのコメント統合機能を使用する場合はd3forumのhtml側ディレクトリ名を指定します。xoopsコメントを使用する場合やコメント機能を無効にする場合は空欄です。 | |
| - | +コメントのforum_id : コメント統合を選択した場合、統合先のforum_id値を必ず指定してください。 | |
| - | | |
| - | これらを設定すれば完了です。(この編集を行うまでは、xoopsコメントシステムが有効です。) | |
| - | | |
| - | **その他 [#y2091bb1] | |
| - | ***関連情報 [#i30dd5a6] | |
| - | - [[minidiary+D3コメント統合へのお知恵を:http://www.xugj.org/modules/d3forum/index.php?topic_id=757#post_id4643]] (XUGJ) | |
| - | - [[D3comment統合と、コメント元のイベント通知:http://www.xugj.org/modules/QandA/index.php?post_id=4875]] (XUGJ) | |
| - | | |
| - | - [[元ソース(D3commentクラス):http://www.mc8.jp/X//modules/downloads/index.php?page=viewcat&cid=2]](モーションクリエイト) | |
| - | | |
| - | ***ライセンス [#af4a772f] | |
| - | -xwordsソース、d3forumソース、xugj_blockソース:GPL | |