XWORDS にAttachfileを適用

投稿ツリー

  • なし XWORDS用 d3pipesクラス (なーお, 2008/3/21 15:50)
  • なし XWORDS にAttachfileを適用 (なーお, 2008/1/7 17:18)
  • なし XCL・wikiレンダラーでXWORDSへ自動リンク (なーお, 2008/1/12 1:44)
  • なし XWORDSにwikiレンダラー組込み (なーお, 2008/1/12 0:49)

  • このトピックの投稿一覧へ

    なーお

    なし XWORDS にAttachfileを適用

    msg# 1.3
    depth:
    1
    前の投稿 - 次の投稿 | 親投稿 - 子投稿なし | 投稿日時 2008/1/7 17:18 | 最終変更
    なーお  長老   投稿数: 1832

    XWORDS に Attachfile を適用

    XWORDS-ver0.46にAttachfile-ver1.4を適用してみました。
    少々面倒です。

    1.  Attachfileモジュールが、対象をD3モジュール前提な感じなので、少々ごまかしが必要。
      以下の内容のファイル「mytrustdirname.php」をつくり、xwordsのルートディレクトリにコピー。
      1
      2
      3
      
      <?php
      	$mytrustdirname = 'xwords' ;
      ?>
    2.  アクセス権限ファイルの作成
      念のため、ゲストにはアップロード不可に。
      XOOPS_TRUST_PATH/modules/attachfile/plugin/xword/permission.php
       1
       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;
      }
       
      ?>
    3.  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
      		{
    4.  テンプレート編集
      •  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>
        23.gif
      •  xwords_entry.html 65行目付近 (「+」部分を追加)
        1
        2
        3
        
           <{$thisterm.term}>
         </h2>
        +<{attachfile_attach_download dirname=attachfile target_id=$com_itemid}>
        24.gif
    投票数:0 平均点:0.00
    返信する

    この投稿に返信する

    題名
    ゲスト名
    投稿本文

      条件検索へ