Skip to content

Commit

Permalink
* bugfix: add localization for the error result of the submit form.
Browse files Browse the repository at this point in the history
  • Loading branch information
franzholz committed Jun 15, 2018
1 parent 241c484 commit ffa5042
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2018-06-15 Franz Holzinger <[email protected]>
* bugfix: add localization for the error result of the submit form.
* new base class: change the Localization class from \JambageCom\Div2007\Base\LocalisationBase to TranslationBase. Change the methods of the $languageObj object accordingly: loadLL => loadLocalLang, getLLkey => getLocalLangKey, getLL => getLabel

2018-06-02 Franz Holzinger <[email protected]>
Expand Down
33 changes: 26 additions & 7 deletions Classes/Controller/Submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,22 @@ static public function execute (TypoScriptFrontendDataController $pObj, $conf)
$local_cObj = \JambageCom\Div2007\Utility\FrontendUtility::getContentObjectRenderer();
$local_cObj->setCurrentVal($pid);
$allowCaching = $conf['allowCaching'] ? 1 : 0;

if (is_array($row)) {
$email = $row['email'];
}
$modelObj = GeneralUtility::makeInstance(\JambageCom\TtBoard\Domain\TtBoard::class);
$modelObj->init();
$allowed = $modelObj->isAllowed($conf['memberOfGroups']);
$languageObj = GeneralUtility::makeInstance(\JambageCom\TtBoard\Api\Localization::class);
$languageObj->init(
TT_BOARD_EXT,
$conf,
DIV2007_LANGUAGE_SUBPATH
);
$languageObj->loadLocalLang(
'EXT:' . TT_BOARD_EXT . DIV2007_LANGUAGE_SUBPATH . 'locallang.xlf',
false
);

if (
$allowed &&
Expand Down Expand Up @@ -188,7 +197,10 @@ static public function execute (TypoScriptFrontendDataController $pObj, $conf)
}

// Send post to Mailing list ...
if ($conf['sendToMailingList'] && $conf['sendToMailingList.']['email']) {
if (
$conf['sendToMailingList'] &&
$conf['sendToMailingList.']['email']
) {
/*
TypoScript for this section (was used for the TYPO3 mailing list.
FEData.tt_board.processScript {
Expand All @@ -212,7 +224,9 @@ static public function execute (TypoScriptFrontendDataController $pObj, $conf)
'usergroup=' . intval($mConf['sendToFEgroup'])
);
$c = 0;
while($feRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
while(
$feRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)
) {
$c++;
$emails .= $feRow['email'] . ',';
}
Expand Down Expand Up @@ -348,13 +362,18 @@ static public function execute (TypoScriptFrontendDataController $pObj, $conf)
}
} else {
if ($allowed) {
$message = $email . ' is not a valid email address.';
$message = sprintf($languageObj->getLabel('error_email'), $email);
} else {
$message = 'You do not have the permission to post into this forum!';
$message = $languageObj->getLabel('error_no_permission');
}

$title = 'Access denied!';
$messagePage = GeneralUtility::makeInstance(ErrorpageMessage::class, $message, $title);
$title = $languageObj->getLabel('error_access_denied');
$messagePage =
GeneralUtility::makeInstance(
ErrorpageMessage::class,
$message,
$title
);
$messagePage->output();
}

Expand Down
9 changes: 9 additions & 0 deletions Resources/Private/Language/locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@
<trans-unit id="wrong_captcha" xml:space="preserve">
<source>Wrong captcha word '%s' entered!</source>
</trans-unit>
<trans-unit id="error_access_denied" xml:space="preserve">
<source>Access denied!</source>
</trans-unit>
<trans-unit id="error_email" xml:space="preserve">
<source>'%s' is not a valid email address!</source>
</trans-unit>
<trans-unit id="error_no_permission" xml:space="preserve">
<source>You do not have the permission to post into this forum!</source>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit ffa5042

Please sign in to comment.