LoginSignup
1
1

More than 5 years have passed since last update.

【メッセージをfancyboxを使ってポップアップでやりとりする】

Last updated at Posted at 2014-01-11

メッセージモジュール

【メッセージをfancyboxを使ってポップアップでやりとりする】
XUGJがメンテしているのでこちらに投稿します。

✓やりたいこと
アカウント情報のPM画像をクリックしたらfacyboxを使ってポップアップでメッセージ画面を表示させて送信する

受信箱の方も動揺に新規作成をポップアップ、
返信テーブルを追加して返信ができるようにする。

まずfancyboxとプリロードをmarineさんのサイトからダウンロードします。

導入についてもこちらのサイトを参照すればスムーズにできるかと思います。

導入が完了したらまず、html/modules/message/actions/newAction.class.phpを開いて

<<<<<<< HEAD
ダイアログモードにするために$this->root->mController->setDialogMode(true);
を157行目付近のexecuteView (&$render) のところに追加します

public function executeView(&$render)
{

$this->root->mController->setDialogMode( true);

ダイアログモードにするために
$this->root->mController->setDialogMode(true);

157行目付近のexecuteView(&$render)のところに追加します

  public function executeView(&$render)
  {
      $this->root->mController->setDialogMode( true);
>>>>>>> EDIT_REQUEST
    $render->setTemplateName( 'message_new.html');
    $render->setAttribute('mActionForm', $this-> mActionForm);
    $render->setAttribute('errMsg', $this->errMsg);
<<<<<<< HEAD
}
=======
  }

EDIT_REQUEST

これを追加することによって、テーマのヘッダーとフッターを読み込まないようになります(間違いだったらスミマセン)

次にサイトの管理画面に入り→ALTSYS→上のタブからテンプレート管理を開いて、

マイフレンドモジュールを導入している場合はマイフレンドを開いて
myfriend_userinfo.htmlを開きます。
導入していない場合は、ユーザーモジュールのuser_userinfo.htmlを開きます

マイフレンドの場合は72行目付近、ユーザーモジュールの場合は50行目付近のa タグのところのfancyboxを追加します。

<{if $xoops_isuser == true & & $pmliteUrl != ''}>
     <tr valign ="top">
       <td class ="head"><{$smarty.const._MD_USER_LANG_PM}></ td>
       <td class ="<{cycle values='odd,even'}>">
          <a class ="fancybox" href="<{$pmliteUrl|xoops_escape:link}>">
            <img src ="<{$smarty.const.XOOPS_URL}>/images/icons/pm.gif" alt= "<{$smarty.const._SENDPMTO|replace:" %s ": $thisUser- >getShow('uname')}>" title="<{$smarty.const._SENDPMTO|replace:"%s":$thisUser->getShow('uname')}>" /> </a >
          </td >
        </tr >
      <{/if}>

 

次にプライベートメッセージのテンプレート管理を開き、message_new.htmlを開きます。

26行目付近からのform actionのところのURLを変えます

これでアカウント情報からのメッセージ送信はポップアップでできるはずです

<form action= "<{$xoops_url}>/modules/message/index.php?action=new" method= "post">
<{xoops_token form=$mActionForm}>
<{xoops_input type=hidden name=mode}>
<table class= "outer">
<tr>< td class= "head"><{$smarty.const._MD_MESSAGE_TEMPLATE2}> </td ><td class= "even"><{xoops_input name=uname size=30 maxlength=50 value=$mActionForm->get('uname')}></ td></ tr>
<tr>< td class= "head"><{$smarty.const._MD_MESSAGE_TEMPLATE4}> </td ><td class= "even"><{xoops_dhtmltarea cols=60 rows=7 name=note value=$mActionForm->get('note')}></ td></ tr>
<tr>< td class= "foot" colspan ="2" align="center">
<input type= "hidden" name ="title" id="legacy_xoopsform_title" value= " "/>
<{legacy_button id=Submit Text=$smarty.const._MD_MESSAGE_TEMPLATE6}></ td></ tr>
</table>
</form>

これでアカウント情報からのプライベートメッセージはfancyboxを使ってポップアップで表示され送信されるはずです。

次に受信箱の所も変更します。

テンプレート管理からプライベートメッセージを開き、message_inboxlist.htmlを開きます。

35行目付近のテーブルに本文表示と返信のためのテーブルを追加します

<th width= "36"><{$smarty.const._MD_MESSAGE_TEMPLATE22}> </th >
<th>< {$smarty.const._MD_MESSAGE_TEMPLATE12}></th >
<th>< {$smarty.const._MD_MESSAGE_TEMPLATE10}></th >
<th>< {$smarty.const._MD_MESSAGE_TEMPLATE4}></th >
<th>< {$smarty.const._MD_MESSAGE_TEMPLATE13}></th >
<th>< {$smarty.const._DELETE}></th >

 
次に内容の文を追加しますだいたい55行目付近

<td id="odd"> 返信< a class= "fancybox" href ="サイトURL/modules/message/index.php?action=new&amp;res=<{$val.inbox_id}>" />
<img src= "<{$smarty.const.XOOPS_MODULE_URL}>/message/images/email_add.png" alt= "<{$smarty.const._MD_MESSAGE_TEMPLATE13}>" title= "<{$smarty.const._MD_MESSAGE_TEMPLATE13}>" ></a >
</td>

<{$val.inbox_id}><{$val.message}>とありますが、
元は<{$msgdata.inbox_id}><{$msgdata.message}>です。

このままだと読み込み出来ないです。

44行目に<{foreach item=val from=$ListData}>item=valと宣言されているので$msgdataの部分を$valとするとうまくいきました。
すでにassign宣言?されているので楽にできました。
ちょっとうろ覚えなので間違っていたらごめんなさい。

3行目の新規作成は先ほどと同じ通りに

<img src="<{$smarty.const.XOOPS_MODULE_URL}>/message/images/email_add.png" alt="<{$smarty.const._MD_MESSAGE_TEMPLATE8}>" title="<{$smarty.const._MD_MESSAGE_TEMPLATE8}>" /> <a class= "fancybox" href="index.php?action=new">< {$smarty.const._MD_MESSAGE_TEMPLATE8}></a ></p>

aタグに class="fancybox" を追加するだけです。

 
 
次に送信ボックスを変更します、

message_outboxlist.htmlを開き

4行目を

<img src="<{$smarty.const.XOOPS_MODULE_URL}>/message/images/email_add.png" alt="<{$smarty.const._MD_MESSAGE_TEMPLATE8}>" title="<{$smarty.const._MD_MESSAGE_TEMPLATE8}>" /> <a class= "fancybox" href="index.php?action=new">< {$smarty.const._MD_MESSAGE_TEMPLATE8}></a ></p>

いつも通りに。

テーブルの内容を変更します
24行目付近から

<form method= "post" action ="index.php?action=deleteall">
<table class= "outer">
<tr>
<th>< {$smarty.const._MD_MESSAGE_TEMPLATE9}></th >
<th>< {$smarty.const._MD_MESSAGE_TEMPLATE10}></th >
<th>< {$smarty.const._MD_MESSAGE_TEMPLATE4}></th >
<th>< {$smarty.const._DELETE}></th >
</tr>
<{foreach item=val from=$ListData}>
<tr>
<td class="odd">< {$val.fromname}></ td>
<td class="odd">< {$val.utime|xoops_formattimestamp:l}></td >
<td class="odd">< {$val.message}></ td>
<td class="odd" align= "center"><input type ="checkbox" name="delmsg[]" value= "<{$val.outbox_id}>" /></ td>
</tr>
<{/foreach}>

これにて改造は完了です。

ちょくちょくツッコミが入りそうですが。。。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1