|
1: 2008-09-01 (月) 09:12:17 なーお ![バックアップ No.1 を復元して編集](http://motioncafe.naaon.com/modules/xpwiki/skin/loader.php?src=page_white_edit.png) |
| + | *myalbumモジュールで、d3コメント統合の簡単化 [#yca26094] |
| + | **概要 [#wfc715cf] |
| + | 以前より、[[myalbumモジュール:http://xoops.peak.ne.jp/md/mydownloads/singlefile.php?lid=61&cid=1]] をコメント統合で使ってはいましたが、携帯用テンプレートの共有化を行う際に、テンプレートにサイト毎に異なるd3forum_dirnameとforum_idを記述する部分で支障があり、何とかしたいと考え、myalbum-ver2.88をベースに手を入れてみました。 |
| | | |
| + | + D3コメントクラスは、[[photositeさん配布のもの:http://www.photositelinks.com/modules/mydownloads/index.php?page=singlefile&cid=1&lid=1]]をベースにして手を入れています。 |
| + | &br; |
| + | + コメント統合先のd3forumディレクトリ名・フォーラムid値は、d3blogのコメント統合を参考に、Xwordsの管理画面でmodule_configに保存する方式としました。 そして、コメント統合のクラスはd3forum-0.83a以降で実装された新方式(「d3comment」で呼ぶほう)を採用しています。 また、D3commentクラス内でforum_idまで認識するため、テンプレート内に記述する必要がありません。 |
| + | こうすることで、複数サイトを共有化している場合でも、携帯用のテンプレートを共通化できますし、テンプレート配布の際にも神経を使わずに済みます。&br;&br; |
| + | |
| + | **手順と方法 [#fd25e32c] |
| + | テンプレートだけでなく、ソースの変更も必要ですので、細かく記しておきます。 |
| + | |
| + | なお、個別のアップロードも編集も面倒、という人のために、myalbumP-ver2.88との差分ファイルパックを、ここに置いておきます。 解凍後、夫々のフォルダに上書きアップロードして使えます。 |
| + | |&ref(myalbum_288a3_diff.zip);| |
| + | |
| + | ***D3commentクラス [#h5e6f661] |
| + | D3commentクラスは、下記ファイルをダウンロード後、「(myalbum)/class」内にアップロードして使用します。 |
| + | |&ref(myalbumD3commentContent.class_0.php);| |
| + | |
| + | 当然ながら、d3forumの方にコメント統合用に掲示板を追加し、(必要があれば)過去のxoopsコメントをインポート後、「コメント統合時の参照方法」に |
| + | myalbum::myalbumD3commentContent:: |
| + | と記載します。(最初の「myalbum」の部分は、インストールディレクトリ名に合わせて変更します。) |
| + | なお、&font(Red){d3forumは0.83a以降のバージョンが必須};で、D3commentの最新のAPIクラス群を忘れずにアップして下さい。 |
| + | |
| + | ***myalbumソースの変更 [#k9614b16] |
| + | 4つのソースファイルに手を入れます。 こんな方法で良いのか自信はありませんが、間違いではないと思うのでご勘弁。 :-D &br; |
| + | |
| + | ****xoops_version.php [#z422d409] |
| + | 「xoops_version.php」を編集し、管理画面にmodule_config項目を追加します。 |
| + | 下記の393~411行目を追記します。 |
| + | #code(php,383-413){{ |
| + | $modversion['config'][] = array( |
| + | 'name' => 'myalbum_usesiteimg' , |
| + | 'title' => '_ALBM_CFG_USESITEIMG' , |
| + | 'description' => '_ALBM_CFG_DESCUSESITEIMG' , |
| + | 'formtype' => 'yesno' , |
| + | 'valuetype' => 'int' , |
| + | 'default' => '0' , |
| + | 'options' => array() |
| + | ) ; |
| + | |
| + | $modversion['config'][] = array( |
| + | 'name' => 'com_agent' , |
| + | 'title' => '_MI_COM_AGENT' , |
| + | 'description' => '_MI_COM_AGENTDSC' , |
| + | 'formtype' => 'textbox', |
| + | 'valuetype' => 'text', |
| + | 'default' => '', |
| + | 'options' => array() |
| + | ); |
| + | |
| + | $modversion['config'][]= array( |
| + | 'name' => 'com_agent_forumid', |
| + | 'title' => '_MI_COM_AGENTID', |
| + | 'description' => '_MI_COM_AGENTIDDSC', |
| + | 'formtype' => 'textbox', |
| + | 'valuetype' => 'int', |
| + | 'default' => '0', |
| + | 'options' => array() |
| + | ); |
| + | |
| + | // Search |
| + | }} |
| + | |
| + | ****languages/japanese/modinfo.php [#f8f54d7d] |
| + | 「modinfo.php」を編集し、上の作業で追加した管理画面の項目に日本語テキストを追加します。 |
| + | 以下の118~121行目を追記します。 |
| + | |
| + | #code(php,116-){{ |
| + | define('_MI_MYALBUM_CATEGORY_NEWPHOTO_NOTIFYSBJ', '[{X_SITENAME}] {X_MODULE}: 新たに写真が登録されました'); |
| + | |
| + | define("_MI_COM_AGENT","コメントシステムの設定"); |
| + | define("_MI_COM_AGENTDSC","d3forumのコメント統合機能を使用する場合は<br/>フォーラムのhtml側ディレクトリ名を指定します。<br/>xoopsコメントを使用する場合やコメント機能を無効にする場合は空欄です。"); |
| + | define("_MI_COM_AGENTID","コメントのforum_id"); |
| + | define("_MI_COM_AGENTIDDSC","コメント統合を選択した場合、forum_idを必ず指定してください。"); |
| + | } |
| + | |
| + | ?> |
| + | }} |
| + | |
| + | ****%%header.php%% [#r46e501f] |
| + | 08/09/01 このファイル「header.php%」の編集では、xoops2.0.16a-JPで問題がありましたので、訂正します。 |
| + | |
| + | ****index.php [#x7e8ad42] |
| + | 「index.php」の、54行目以降を以下のように編集します。 |
| + | #code(php,54-){{ |
| + | while( $fetched_result_array = $xoopsDB->fetchArray( $prs ) ) { |
| + | $xoopsTpl->append( 'photos' , myalbum_get_array_for_photo_assign( $fetched_result_array , true ) ) ; |
| + | } |
| + | |
| + | // モジュール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); |
| + | |
| + | include( XOOPS_ROOT_PATH . "/footer.php" ) ; |
| + | |
| + | ?> |
| + | }} |
| + | |
| + | ****photo.php [#x7e8ad42] |
| + | 「photo.php」の、117行目以降を以下のように編集します。 |
| + | #code(php,115-){{ |
| + | $xoopsTpl->assign( 'photo_nav' , $photo_nav ) ; |
| + | |
| + | // comments |
| + | // モジュール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); |
| + | |
| + | include XOOPS_ROOT_PATH.'/include/comment_view.php'; |
| + | |
| + | include( XOOPS_ROOT_PATH . "/footer.php" ) ; |
| + | |
| + | ?> |
| + | }} |
| + | |
| + | ***テンプレートの編集 [#l180e8e9] |
| + | 続いて、テンプレートを2つ、Altsysなどで編集します。 |
| + | |
| + | ****myalbum_photo.html [#bec2f707] |
| + | 「myalbum_photo.html」の、97行目付近を以下のように編集します。 |
| + | |
| + | #code(html,98-){{ |
| + | <{* COMMENT COUNTS *}> |
| + | <img src='<{$mod_url}>/images/comments.gif' width='16' height='16' alt='<{$lang_commentsc}>' title='<{$lang_commentsc}>' /><{$photo.comments}> |
| + | |
| + | <{* RANK & RATING *}> |
| + | }} |
| + | |
| + | ↓ ここを変更 |
| + | |
| + | #code(html,98-){{ |
| + | <{* COMMENT COUNTS *}> |
| + | <img src='<{$mod_url}>/images/comments.gif' width='16' height='16' alt='<{$lang_commentsc}>' title='<{$lang_commentsc}>' /> |
| + | <{if $moduleConfig.com_agent}> |
| + | <{d3comment mode="count" var="comcount" mydirname=$xoops_dirname id=$photo.lid class="myalbumD3commentContent"}> |
| + | <{if $comcount}> |
| + | (<{$comcount}>) |
| + | <{else}> |
| + | (0) |
| + | <{/if}> |
| + | <{else}> |
| + | <{$photo.comments}> |
| + | <{/if}> |
| + | <{* RANK & RATING *}> |
| + | }} |
| + | |
| + | そして、153行目付近を変更 |
| + | |
| + | #code(html,153-){{ |
| + | <div style="margin: 3px; padding: 3px;"> |
| + | <{if $moduleConfig.com_agent}> |
| + | <{d3comment mydirname=$xoops_dirname id=$photo.lid subject=$photo.title class="myalbumD3commentContent"}> |
| + | |
| + | <{else}> |
| + | <div style="text-align: center; padding: 3px; margin: 3px;"> |
| + | <{$commentsnav}> |
| + | <{$lang_notice}> |
| + | </div> |
| + | |
| + | <!-- 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 --> |
| + | <{/if}> |
| + | </div> |
| + | }} |
| + | |
| + | ****myalbum_photo_in_list.html [#bec2f707] |
| + | 「myalbum_photo_in_list.html」の、97行目付近を以下のように編集します。 |
| + | |
| + | #code(html,89-){{ |
| + | <{* COMMENT COUNTS *}> |
| + | <img src='<{$mod_url}>/images/comments.gif' width='16' height='16' alt='<{$lang_commentsc}>' title='<{$lang_commentsc}>' /><{$photo.comments}> |
| + | |
| + | <{* RANK & RATING *}> |
| + | }} |
| + | |
| + | ↓ ここを変更 |
| + | |
| + | #code(html,89-){{ |
| + | <{* COMMENT COUNTS *}> |
| + | <img src='<{$mod_url}>/images/comments.gif' width='16' height='16' alt='<{$lang_commentsc}>' title='<{$lang_commentsc}>' /> |
| + | <{if $moduleConfig.com_agent}> |
| + | <{d3comment mode="count" var="comcount" mydirname=$xoops_dirname id=$photo.lid class="myalbumD3commentContent"}> |
| + | <{if $comcount}> |
| + | (<{$comcount}>) |
| + | <{else}> |
| + | (0) |
| + | <{/if}> |
| + | <{else}> |
| + | <{$photo.comments}> |
| + | <{/if}> |
| + | |
| + | <{* RANK & RATING *}> |
| + | }} |
| + | |
| + | ***モバイル用テンプレート [#f4145bb4] |
| + | モバイルテンプハウスで、[[作成・公開中:http://www.mc8.jp/HD/modules/xpwiki?Templates/myalbum]]。 |
| + | |
| + | **インストールと設定 [#m6eb5c64] |
| + | xoops管理画面の「モジュールの管理」で、''&font(Maroon){「myalbum」をモジュールアップデート};''します。 これで、「myalbum」の管理画面に、2つの項目が追加されます。 |
| + | |
| + | &ref(myalbum_config.gif,mw:200,mh:200); |
| + | |
| + | ここで、 |
| + | +コメントシステムの設定 : d3forumのコメント統合機能を使用する場合はd3forumのhtml側ディレクトリ名を指定します。xoopsコメントを使用する場合やコメント機能を無効にする場合は空欄です。 |
| + | +コメントのforum_id : コメント統合を選択した場合、統合先のforum_id値を必ず指定してください。 |
| + | |
| + | これらを設定すれば完了です。(この編集を行うまでは、xoopsコメントシステムが有効です。) |
| + | |
| + | **その他 [#e7c4b4e1] |
| + | ***関連情報 [#o63d5f41] |
| + | - [[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) |
| + | |
| + | ***ライセンス [#h11ff29b] |
| + | -myalbumソース、d3forumソース、photositeさんのd3commentクラス:GPL |