Skip to content

Commit

Permalink
回答メール定型文にデフォルト対応 #79
Browse files Browse the repository at this point in the history
  • Loading branch information
akagane99 committed May 6, 2016
1 parent 366ff53 commit c291144
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 12 deletions.
Binary file modified Locale/eng/LC_MESSAGES/mails.mo
Binary file not shown.
21 changes: 20 additions & 1 deletion Locale/eng/LC_MESSAGES/mails.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"PO-Revision-Date: 2016-05-03 12:25+0900\n"
"PO-Revision-Date: 2016-05-06 14:20+0900\n"
"Language-Team: EMAIL@ADDRESS\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -61,6 +61,25 @@ msgstr ""
"name<br>{X-SUBJECT} : Title<br>{X-USER} : Posted<br>{X-TO_DATE} : Post time<br>{X-BODY} : Posted "
"content<br>{X-URL} : Content of the posts URL"

msgid "MailSetting.mail_fixed_phrase_subject.answer"
msgstr "[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT} answer"

msgid "MailSetting.mail_fixed_phrase_body.answer"
msgstr ""
"{X-PLUGIN_NAME} we've been responded to.\n"
"Room name: {X-ROOM}\n"
"Title: {X-SUBJECT}\n"
"Respondents: {X-USER}\n"
"Answer time: {X-TO_DATE}\n"
"\n"
"Answer to see the results click on the link below.\n"
"{X-URL}"

msgid "MailSetting.mail_fixed_phrase_body.popover.answer"
msgstr ""
"{X-SITE_NAME}: Site name<br> {X-PLUGIN_NAME}: Plugin name<br> {X-ROOM}: Room name<br> {X-SUBJECT}: title<br> "
"{X-USER}: Respondents<br> {X-TO_DATE}: Answer time<br> {X-URL}: URL of answers"

#: Plugin/Mails/View/Elements/edit_form.ctp:47
msgid "Use the mail notification function"
msgstr "Use the mail notification function"
Expand Down
Binary file modified Locale/jpn/LC_MESSAGES/mails.mo
Binary file not shown.
23 changes: 21 additions & 2 deletions Locale/jpn/LC_MESSAGES/mails.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"PO-Revision-Date: 2016-05-03 12:25+0900\n"
"PO-Revision-Date: 2016-05-06 14:20+0900\n"
"Language-Team: EMAIL@ADDRESS\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -57,7 +57,26 @@ msgstr ""
msgid "MailSetting.mail_fixed_phrase_body.popover"
msgstr ""
"{X-SITE_NAME} : サイト名<br>{X-PLUGIN_NAME} : プラグイン名<br>{X-ROOM} : ルーム名<br>{X-BLOCK_NAME} : ブロック名<br>{X-SUBJECT} : タイトル"
"<br />{X-USER} : 投稿者<br />{X-TO_DATE} : 投稿日時<br />{X-BODY} : 投稿内容<br />{X-URL} : 投稿内容のURL"
"<br>{X-USER} : 投稿者<br>{X-TO_DATE} : 投稿日時<br>{X-BODY} : 投稿内容<br>{X-URL} : 投稿内容のURL"

msgid "MailSetting.mail_fixed_phrase_subject.answer"
msgstr "[{X-SITE_NAME}-{X-PLUGIN_NAME}]{X-SUBJECT}回答"

msgid "MailSetting.mail_fixed_phrase_body.answer"
msgstr ""
"{X-PLUGIN_NAME}に回答されたのでお知らせします。\n"
"ルーム名:{X-ROOM}\n"
"タイトル:{X-SUBJECT}\n"
"回答者:{X-USER}\n"
"回答日時:{X-TO_DATE}\n"
"\n"
"回答結果を参照するには下記のリンクをクリックして下さい。\n"
"{X-URL}"

msgid "MailSetting.mail_fixed_phrase_body.popover.answer"
msgstr ""
"{X-SITE_NAME} : サイト名<br>{X-PLUGIN_NAME} : プラグイン名<br>{X-ROOM} : ルーム名<br>{X-SUBJECT} : タイトル<br>{X-USER} : 回答者<br>{X-"
"TO_DATE} : 回答日時<br>{X-URL} : 回答結果のURL"

#: Plugin/Mails/View/Elements/edit_form.ctp:47
msgid "Use the mail notification function"
Expand Down
9 changes: 9 additions & 0 deletions Locale/mails.pot
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ msgstr ""
msgid "MailSetting.mail_fixed_phrase_body.popover"
msgstr ""

msgid "MailSetting.mail_fixed_phrase_subject.answer"
msgstr ""

msgid "MailSetting.mail_fixed_phrase_body.answer"
msgstr ""

msgid "MailSetting.mail_fixed_phrase_body.popover.answer"
msgstr ""

#: Plugin/Mails/View/Elements/edit_form.ctp:47
msgid "Use the mail notification function"
msgstr ""
Expand Down
36 changes: 27 additions & 9 deletions Model/MailSettingFixedPhrase.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function beforeValidate($options = array()) {
* メール設定-定型文 データ新規作成
*
* @param int $languageId 言語ID
* @param string $typeKey メールの種類
* @param string $typeKey メール定型文の種類
* @param string $pluginKey プラグインキー
* @return array メール設定データ配列
*/
Expand All @@ -105,17 +105,13 @@ public function createMailSettingFixedPhrase($languageId = null, $typeKey = self
$mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.id');
} else {
$mailFixedPhrase = $this->create();
$mailFixedPhrase[$this->alias]['type_key'] = $typeKey;
}

//初期データセット
if (! $mailFixedPhrase[$this->alias]['mail_fixed_phrase_subject']) {
$mailFixedPhrase[$this->alias]['mail_fixed_phrase_subject'] =
__d('mails', 'MailSetting.mail_fixed_phrase_subject');
}
if (! $mailFixedPhrase[$this->alias]['mail_fixed_phrase_body']) {
$mailFixedPhrase[$this->alias]['mail_fixed_phrase_body'] =
__d('mails', 'MailSetting.mail_fixed_phrase_body');
}
$this->__noSetData('mail_fixed_phrase_subject', $mailFixedPhrase, $typeKey);
$this->__noSetData('mail_fixed_phrase_body', $mailFixedPhrase, $typeKey);

$mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.created');
$mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.created_user');
$mailFixedPhrase = Hash::remove($mailFixedPhrase, '{s}.modified');
Expand All @@ -138,4 +134,26 @@ public function getMailSettingFixedPhrase($conditions, $type = 'first') {
));
return $mailSetting;
}

/**
* Dataにセットされてなかったら、セット
*
* @param string $key 配列のキー
* @param array &$mailFixedPhrase メール設定データ配列
* @param string $typeKey メール定型文の種類
* @return void
*/
private function __noSetData($key, &$mailFixedPhrase, $typeKey = self::DEFAULT_TYPE) {
if ($mailFixedPhrase[$this->alias][$key]) {
return;
}

if ($typeKey == self::DEFAULT_TYPE) {
$mailFixedPhrase[$this->alias][$key] = __d('mails', 'MailSetting.' . $key);
} elseif ($typeKey == self::ANSWER_TYPE) {
$mailFixedPhrase[$this->alias][$key] = __d('mails', 'MailSetting.' . $key . '.answer');
} else {
$mailFixedPhrase[$this->alias][$key] = '';
}
}
}

0 comments on commit c291144

Please sign in to comment.