CUBIC4 Web Creative Laboratory

これも関係ある?

リリース Joomla! 1.6.1

リリース Joomla! 1.6.1

リリース Joomla! 1.6.2

HOME > CMS > Extension > JFormsで件名を変更など

JFormsで件名を変更など
0 評価
Extension
2010年 4月 30日(金曜日) 17:39
jformこのサイトにメールフォームが無かったのでJFormを入れてみました。

ファイルや日本語化ファイルはスグあるんですが、このJFormはメールの件名にフォームの入力内容を反映させることが出来ません。

メールアドレスの判定も全然です;


でもフォームの追加などが簡単でその操作性が気に入ったのでこれを使います。(バックエンドが気に入っても触るのは最初だけなんですけど・・・)

で件名にフォームの内容を反映させる所ですが、今回はコアを変更しました。

件名というラベルのフォームに何か入っていればそれをメールの件名に挿入させます。

/administrator/components
/com_jforms/plugins/storage/Mail/Mail.php
83
84
85
86
87
88
89
90
91
foreach($form->fields as $f){
 
if( array_key_exists('isUserEmail',$f->parameters) && $f->parameters['isUserEmail'] == true ){
$hash = $f->parameters['hash'];
//Grab it from current record
$userEmail = $data[$hash];
break;
}
}
を以下のように
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
foreach($form->fields as $f){
 
if( array_key_exists('isUserEmail',$f->parameters) && $f->parameters['isUserEmail'] == true ){
$hash = $f->parameters['hash'];
//Grab it from current record
$userEmail = $data[$hash];
break;
}
 
}
$usersubject = '';
foreach($form->fields as $f){
if( $f->parameters['label'] == '件名' ){
$hash = $f->parameters['hash'];
//Grab it from current record
$usersubject = $data[$hash];
break;
}
}

 

また
114
115
116
117
//$mail->setSender( array( $email, $name ) );
$mail->SetSubject(JText::_('New entry added'));
$mail->SetBody( $adminMessage );
$mail->Send();

114
115
116
117
118
119
120
121
122
//$mail->setSender( array( $email, $name ) );
if( $usersubject ){
$mail->SetSubject( $usersubject.' - '.JText::_('New entry added') );
}else{
$mail->SetSubject(JText::_('New entry added'));
}
//$mail->SetSubject(JText::_('New entry added'));
$mail->SetBody( $adminMessage );
$mail->Send();
に変更します。

その他ボタンを横に並べたかったので
/administrator/components
/com_jforms/plugins/elements/button/button.php
を編集してクラス名をつけるようにしました。
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$output .= _line("<input name='$p->hash' class='$css' type='submit' value='$p->label' style='width:{$p->cw}px;height:{$p->ch}px;' />",2);
break;
 
case 'Reset':
$output .= _line("<input name='$p->hash' class='$css' type='reset' value='$p->label' style='width:{$p->cw}px;height:{$p->ch}px;' />",2);
break;
 
case 'Button':
 
$p->clickTrigger = htmlspecialchars($p->clickTrigger, ENT_QUOTES);
$onClickScript = strlen(trim($p->clickTrigger))?"onclick=\"$p->clickTrigger\"":'';
$output .= _line("<input name='$p->hash' type='button' class='$css' $onClickScript value='$p->label' style='width:{$p->cw}px;height:{$p->ch}px;' />",2);
break;
 
}
$output .= _line('<div class="clear"></div>',2);
から
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$output .= _line("<input name='$p->hash' class='$css $p->hash' type='submit' value='$p->label' style='width:{$p->cw}px;height:{$p->ch}px;' />",2);
break;
 
case 'Reset':
$output .= _line("<input name='$p->hash' class='$css $p->hash' type='reset' value='$p->label' style='width:{$p->cw}px;height:{$p->ch}px;' />",2);
break;
 
case 'Button':
 
$p->clickTrigger = htmlspecialchars($p->clickTrigger, ENT_QUOTES);
$onClickScript = strlen(trim($p->clickTrigger))?"onclick=\"$p->clickTrigger\"":'';
$output .= _line("<input name='$p->hash' type='button' class='$css $p->hash' $onClickScript value='$p->label' style='width:{$p->cw}px;height:{$p->ch}px;' />",2);
break;
 
}
$output .= _line('<div class="clear '.$p->hash.'"></div>',2);

 

あとは今回使ってませんが日付のフォームも順番を入れ換えたりしました。
取り合えずこれでサイトのフォームは良いかなと・・・
最終更新 2010年 4月 30日(金曜日) 18:24
 
トラックバック
ユーザ名
パスワード
Advertisement
twitter follow me

Welcome to CUBIC4

会員登録はもうお済ですか?

会員登録をすると
記事へのコメント等の会員サービスを利用できます。
現在それぐらいしか無いのであまりする意味ないです。
※Gmailアカウントでもログインできます。

ということは・・・

コメントをどうしても書き込みたい!
そんな場合のみ会員登録ください。

ログイン

未登録ですか? 新規登録!

*
*
*
*
*
(*) は入力必須項目です。