inquirySPフォームに元記事ページ情報埋込み

「問い合わせ」モジュール:inquirySPは元々使っていましたが、 他のモジュールの記事にボタンを貼って、そこからinquirySPに飛んできた時に、元記事情報を埋め込んで送信する、というアイデアは思いつきもしませんでした。

XUGJにトピが立ったので、試してみたところうまく行きまして、自分でも d3blog, pico, xpwiki,xwords に使ってみることにしました。 thx tomoroさん

元ネタ: XUGJでの当該トピ

modules/inquirysp/index.phpのハック

元記事からpost受信したデキストデータを、smarty変数にアサインする。

280行目あたりに、以下を追記 (inquirySP-ver1.02の例)

274
275
276
277
278
279
280
281
282
283
284
285
286
287
    //登録ユーザの確認
    if ( isset($xoopsUser) && is_object($xoopsUser) ) {
      $view->assign('defname', inq_slineText($xoopsUser->uname()));
      $view->assign('defmail', inq_slineText($xoopsUser->email()));
    }
      
    $title_ = $inq_req->get_post_var('title'); //add from
    if ($title_) {
        $view->assign('title', inq_slineText($title_));
    }
    $url_ = $inq_req->get_post_var('url');
    if ($url_) {
        $view->assign('url', inq_slineText($url_));
    }  //add to

inquiry_form_0.html の編集

4
5
6
  /* * フォームの設定 * */
  $inqtmp['title'] = array('参照記事タイトル','text','1');
  $inqtmp['url'] = array('参照記事URL','text','1');
18
19
20
  //自動返信時のテンプレート埋め込み設定
  //$req_r = false;//(使わない場合)
  $req_r = array('name','mail','note','title','url');
Everything is expanded.Everything is shortened.
53
54
55
56
57
58
59
60
 
 
 
 
 
 
 
 
          <tr>
            <td>参照記事タイトル</td>
            <td><input type="text" name="inqv[title]" value="<{if $title}><{$title}><{/if}>" size=60 /></td>
          </tr>
          <tr>
            <td>参照記事URL</td>
            <td><input type="text" name="inqv[url]" value="<{if $url}><{$url}><{/if}>" size=60 /></td>
          </tr>

各モジュールのtemplate編集

テンプレートにformタグ(hidden)、ボタンを配置

d3blog

d3blog_main_details.html

Everything is expanded.Everything is shortened.
 
 
 
 
 
<form action="<{$xoops_url}>/modules/inquirysp/index.php?op=0" method="POST">
<input type="hidden" name="title" value="<{$entry.title}>" />
<input type="hidden" name="url" value="<{$xoops_url}><{$xoops_requesturi}>" />
<input value="この記事に関する問合せフォームを開く" type="submit">
</form>
pico

pico_main_viewcontent.html

Everything is expanded.Everything is shortened.
 
 
 
 
 
<form action="<{$xoops_url}>/modules/inquirysp/index.php?op=0" method="POST">
<input type="hidden" name="title" value="<{$content.subject}>" />
<input type="hidden" name="url" value="<{$xoops_url}><{$xoops_requesturi}>" />
<input value="この記事に関する問合せフォームを開く" type="submit">
</form>
xpwiki

xpwiki_main_d3comment.html

Everything is expanded.Everything is shortened.
 
 
 
 
 
<form action="<{$xoops_url}>/modules/inquirysp/index.php?op=0" method="POST">
<input type="hidden" name="title" value="<{$content.subject}>" />
<input type="hidden" name="url" value="<{$xoops_url}>/modules/xpwiki/<{$content.id}>.html" />
<input value="この記事に関する問合せフォームを開く" type="submit">
</form>

xpwikiの場合だけ、<{$xoops_requesturi}>で取得できなかったので、ちょっとパターンを変えてます。

xwords

xwords_entry.html

Everything is expanded.Everything is shortened.
 
 
 
 
 
<form action="<{$xoops_url}>/modules/inquirysp/index.php?op=0" method="POST">
<input type="hidden" name="title" value="<{$thisterm.term}>" />
<input type="hidden" name="url" value="<{$xoops_url}><{$xoops_requesturi}>" />
<input value="この記事に関する問合せフォームを開く" type="submit">
</form>

これで、掲示板に書き残すことに抵抗がある人からの質問も、入るかもしれませんね。 ログを残すという点からは好ましくはありませんが。。 :-P