XWORDS にAttachfileを適用
投稿ツリー
-
XCLでXWORDSを使う (なーお, 2008/1/12 10:19)
- XWORDS用 piCalプラグイン、D3commentクラス (なーお, 2008/1/7 8:38)
- XWORDS用 d3pipesクラス (なーお, 2008/3/22 0:50)
- XWORDS にAttachfileを適用 (なーお, 2008/1/8 2:18)
-
XCL・wikiレンダラーでXWORDSへ自動リンク (なーお, 2008/1/12 10:44)
- XWORDSにwikiレンダラー組込み (なーお, 2008/1/12 9:49)
なーお
投稿数: 1746
XWORDS に Attachfile を適用
XWORDS-ver0.46にAttachfile-ver1.4を適用してみました。
少々面倒です。
- Attachfileモジュールが、対象をD3モジュール前提な感じなので、少々ごまかしが必要。
以下の内容のファイル「mytrustdirname.php」をつくり、xwordsのルートディレクトリにコピー。1 2 3
<?php $mytrustdirname = 'xwords' ; ?>
- アクセス権限ファイルの作成
念のため、ゲストにはアップロード不可に。
XOOPS_TRUST_PATH/modules/attachfile/plugin/xword/permission.php1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<?php // =========================================================================== // The permission file is necessary in each module. // If target module is "D3 module", the permission file is necessary // in each directory in XOOPS_TRUST_PATH (not XOOPS_ROOT_PATH). // // -- argument -- // // $mydirname : attachfile's dirname in XOOPS_ROOT_PATH // $module_dirname : target module's dirname in XOOPS_ROOT_PATH // $mytrustdirname : attachfile's dirname in XOOPS_TRUST_PATH // $targettrustdirname : target module's dirname in XOOPS_TRUST_PATH // $target_id : target mosule's contents id (target to attach) // // -- return value -- // // true : allow access // false : deny access // =========================================================================== function attachfile_check_upload_permission_plugin( $mydirname , $module_dirname , $mytrustdirname , $targettrustdirname , $target_id ) { global $xoopsUser ; if( $xoopsUser ) { return true; } else { return false; } } function attachfile_check_download_permission_plugin( $mydirname , $module_dirname , $mytrustdirname , $targettrustdirname , $target_id ) { return true; } ?>
- xwordsのsubmit.php のハック
submit.phpの210行目付近1 2 3 4 5 6 7 8
else { $legenddesc = constant("_MD_{$MYDIRNAME}_SUB_SNEWNAMEDESC2"); } $xoopsTpl -> assign ( 'entryID', $entryID ); //←naao hack この行を追加 } else // therez no parameter, so were adding an entry {
- テンプレート編集
- xwords_submit.html 45行目付近 (「+」部分を追加)
1 2 3 4 5 6 7 8 9 10
<{/foreach}> + <tr valign="top" align="left"> + <th class="head"> + <{attachfile_attach_upload dirname=attachfile label=1}> + </th> + <td class="even"> + <{attachfile_attach_upload dirname=attachfile target_id=$entryID}> + </td> + </tr> </table>
- xwords_entry.html 65行目付近 (「+」部分を追加)
1 2 3
<{$thisterm.term}> </h2> +<{attachfile_attach_download dirname=attachfile target_id=$com_itemid}>
- xwords_submit.html 45行目付近 (「+」部分を追加)
投票数:0
平均点:0.00
返信する