Skip to content

Commit

Permalink
[TASK] cleanup deprecated API call
Browse files Browse the repository at this point in the history
* Icons are recreated in 16x16 px
* moving module template to resources folder
* moving and renaming module locallang
* remove mod folder. Changed addModule calls.
* renaming txdirectmailMx to its readable module name
* convert locallang xml to xlf

Resolves: #71615
Releases: master
Change-Id: I25d3e7d40f4c193e507f38f23ccc0ab1a9168c74
Reviewed-on: https://review.typo3.org/45367
Reviewed-by: Ivan Dharma Kartolo <[email protected]>
Tested-by: Ivan Dharma Kartolo <[email protected]>
  • Loading branch information
kartolo committed Feb 21, 2016
1 parent c66e222 commit 27935f8
Show file tree
Hide file tree
Showing 109 changed files with 7,959 additions and 4,943 deletions.
2 changes: 1 addition & 1 deletion Classes/Dmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ function runcron() {
}

// always include locallang file
$this->getLanguageService()->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xml');
$this->getLanguageService()->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xlf');

$pt = GeneralUtility::milliseconds();

Expand Down
52 changes: 43 additions & 9 deletions Classes/Module/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@


use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\DebugUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use DirectMailTeam\DirectMail\DirectMailUtility;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

/**
* Module Configuration for tx_directmail extension
Expand Down Expand Up @@ -75,14 +75,28 @@ class Configuration extends BaseScriptClass {
*/
protected $iconFactory;

/**
* The name of the module
*
* @var string
*/
protected $moduleName = 'DirectMailNavFrame_Configuration';

/**
* Constructor
*/
public function __construct() {
$this->MCONF = array(
'name' => $this->moduleName
);
}

/**
* Standard initialization
*
* @return void
*/
public function init() {
$this->MCONF = $GLOBALS['MCONF'];

parent::init();

$temp = BackendUtility::getModTSconfig($this->id,'mod.web_modules.dmail');
Expand Down Expand Up @@ -129,6 +143,27 @@ public function init() {
$this->updatePageTS();
}

/**
* Entrance from the backend module. This replace the _dispatch
*
* @param ServerRequestInterface $request The request object from the backend
* @param ResponseInterface $response The reponse object sent to the backend
*
* @return ResponseInterface Return the response object
*/
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->getLanguageService()->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xlf');
$this->getLanguageService()->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_csh_sysdmail.xlf');

$this->init();

$this->main();
$this->printContent();

$response->getBody()->write($this->content);
return $response;
}

/**
* The main function.
*
Expand All @@ -146,7 +181,7 @@ public function main() {
// Draw the header.
$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS["BACK_PATH"];
$this->doc->setModuleTemplate('EXT:direct_mail/mod3/mod_template.html');
$this->doc->setModuleTemplate('EXT:direct_mail/Resources/Private/Templates/Module.html');
$this->doc->form = '<form action="" method="post" name="' . $this->formname . '" enctype="multipart/form-data">';

$this->doc->addStyleSheet('direct_mail', ExtensionManagementUtility::extRelPath('direct_mail') . '/Resources/Public/StyleSheets/modules.css');
Expand Down Expand Up @@ -294,7 +329,6 @@ function toggleDisplay(toggleId, e, countBox) { //
*/
function printContent() {
$this->content .= $this->doc->endPage();
echo $this->content;
}

/**
Expand Down
55 changes: 45 additions & 10 deletions Classes/Module/Dmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
*/

use DirectMailTeam\DirectMail\Dmailer;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use DirectMailTeam\DirectMail\DirectMailUtility;
use TYPO3\CMS\Core\Imaging\IconFactory;
Expand Down Expand Up @@ -75,14 +76,28 @@ class Dmail extends BaseScriptClass {

protected $currentStep = 1;

/**
* The name of the module
*
* @var string
*/
protected $moduleName = 'DirectMailNavFrame_DirectMail';

/**
* Constructor
*/
public function __construct() {
$this->MCONF = array(
'name' => $this->moduleName
);
}

/**
* First initialization of global variables
*
* @return void
*/
function init() {
$this->MCONF = $GLOBALS['MCONF'];

parent::init();

// initialize IconFactory
Expand Down Expand Up @@ -148,7 +163,27 @@ function init() {
*/
function printContent() {
$this->content .= $this->doc->endPage();
echo $this->content;
}

/**
* Entrance from the backend module. This replace the _dispatch
*
* @param ServerRequestInterface $request The request object from the backend
* @param ResponseInterface $response The reponse object sent to the backend
*
* @return ResponseInterface Return the response object
*/
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->getLanguageService()->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xlf');
$this->getLanguageService()->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_csh_sysdmail.xlf');

$this->init();

$this->main();
$this->printContent();

$response->getBody()->write($this->content);
return $response;
}

/**
Expand All @@ -172,7 +207,7 @@ function main() {
// Draw the header.
$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('EXT:direct_mail/mod2/mod_template.html');
$this->doc->setModuleTemplate('EXT:direct_mail/Resources/Private/Templates/ModuleDirectMail.html');
$this->doc->form = '<form action="" method="post" name="' . $this->formname . '" enctype="multipart/form-data">';

// Add CSS
Expand Down Expand Up @@ -1132,7 +1167,7 @@ function cmd_testmail() {
);
$msg = $this->getLanguageService()->getLL('testmail_mailgroup_msg') . '<br /><br />';
while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
$msg .='<a href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM2') . '&id=' . $this->id . '&sys_dmail_uid=' . $this->sys_dmail_uid . '&CMD=send_mail_test&sys_dmail_group_uid[]=' . $row['uid'] . '">' .
$msg .='<a href="' . BackendUtility::getModuleUrl('DirectMailNavFrame_DirectMail') . '&id=' . $this->id . '&sys_dmail_uid=' . $this->sys_dmail_uid . '&CMD=send_mail_test&sys_dmail_group_uid[]=' . $row['uid'] . '">' .
$this->iconFactory->getIconForRecord('sys_dmail_group', $row, Icon::SIZE_SMALL) .
htmlspecialchars($row['title']) . '</a><br />';
// Members:
Expand Down Expand Up @@ -1221,7 +1256,7 @@ function getRecordList(array $listArr, $table, $editLinkFlag=1, $testMailLink=0)
}

if ($testMailLink) {
$testLink = '<a href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM2') . '&id=' . $this->id . '&sys_dmail_uid=' . $this->sys_dmail_uid . '&CMD=send_mail_test&tt_address_uid=' . $row['uid'] . '">' . htmlspecialchars($row['email']) . '</a>';
$testLink = '<a href="' . BackendUtility::getModuleUrl('DirectMailNavFrame_DirectMail') . '&id=' . $this->id . '&sys_dmail_uid=' . $this->sys_dmail_uid . '&CMD=send_mail_test&tt_address_uid=' . $row['uid'] . '">' . htmlspecialchars($row['email']) . '</a>';
} else {
$testLink = htmlspecialchars($row['email']);
}
Expand Down Expand Up @@ -1782,7 +1817,7 @@ function cmd_news () {
$iconPreview = $iconPreviewHtml . '&nbsp;&nbsp;' . $iconPreviewText;
}

$createDmailLink = BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM2') . '&id=' . $this->id . '&createMailFrom_UID=' . $row['uid'] . '&fetchAtOnce=1&CMD=info';
$createDmailLink = BackendUtility::getModuleUrl('DirectMailNavFrame_DirectMail') . '&id=' . $this->id . '&createMailFrom_UID=' . $row['uid'] . '&fetchAtOnce=1&CMD=info';
$pageIcon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL) . '&nbsp;' . htmlspecialchars($row['title']);

$outLines[] = array(
Expand All @@ -1809,7 +1844,7 @@ function cmd_news () {
* @return string the link
*/
function linkDMail_record($str,$uid) {
return '<a class="t3-link" href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM2') . '&id=' . $this->id . '&sys_dmail_uid=' . $uid . '&CMD=info&fetchAtOnce=1">' . htmlspecialchars($str) . '</a>';
return '<a class="t3-link" href="' . BackendUtility::getModuleUrl('DirectMailNavFrame_DirectMail') . '&id=' . $this->id . '&sys_dmail_uid=' . $uid . '&CMD=info&fetchAtOnce=1">' . htmlspecialchars($str) . '</a>';
}


Expand Down Expand Up @@ -1868,7 +1903,7 @@ function deleteLink($uid) {
$icon = $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL);
$dmail = BackendUtility::getRecord('sys_dmail', $uid);
if (!$dmail['scheduled_begin']) {
return '<a href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM2') . '&id=' . $this->id . '&CMD=delete&uid=' . $uid . '">' . $icon . '</a>';
return '<a href="' . BackendUtility::getModuleUrl('DirectMailNavFrame_DirectMail') . '&id=' . $this->id . '&CMD=delete&uid=' . $uid . '">' . $icon . '</a>';
}

return '';
Expand Down
48 changes: 42 additions & 6 deletions Classes/Module/MailerEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

/**
* Module Mailer-Engine for tx_directmail extension
Expand Down Expand Up @@ -59,14 +61,28 @@ class MailerEngine extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
*/
protected $iconFactory;

/**
* The name of the module
*
* @var string
*/
protected $moduleName = 'DirectMailNavFrame_MailerEngine';

/**
* Constructor
*/
public function __construct() {
$this->MCONF = array(
'name' => $this->moduleName
);
}

/**
* Initializing global variables
*
* @return void
*/
function init() {
$this->MCONF = $GLOBALS['MCONF'];

parent::init();

// initialize IconFactory
Expand Down Expand Up @@ -106,6 +122,27 @@ function init() {
}
}

/**
* Entrance from the backend module. This replace the _dispatch
*
* @param ServerRequestInterface $request The request object from the backend
* @param ResponseInterface $response The reponse object sent to the backend
*
* @return ResponseInterface Return the response object
*/
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->getLanguageService()->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xlf');
$this->getLanguageService()->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_csh_sysdmail.xlf');

$this->init();

$this->main();
$this->printContent();

$response->getBody()->write($this->content);
return $response;
}

/**
* The main function.
*
Expand All @@ -122,7 +159,7 @@ function main() {
// Draw the header.
$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS["BACK_PATH"];
$this->doc->setModuleTemplate('EXT:direct_mail/mod3/mod_template.html');
$this->doc->setModuleTemplate('EXT:direct_mail/Resources/Private/Templates/Module.html');
$this->doc->form='<form action="" method="post" name="' . $this->formname . '" enctype="multipart/form-data">';

// JavaScript
Expand Down Expand Up @@ -217,7 +254,6 @@ function jumpToUrlD(URL) { //
*/
function printContent() {
$this->content.=$this->doc->endPage();
echo $this->content;
}

/**
Expand Down Expand Up @@ -347,7 +383,7 @@ function cmd_mailerengine() {

// Invoke engine
if ($enableTrigger) {
$out = '<p>' . $this->getLanguageService()->getLL('dmail_mailerengine_manual_explain') . '<br /><br /><a class="t3-link" href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM5') . '&id=' . $this->id . '&invokeMailerEngine=1"><strong>' . $this->getLanguageService()->getLL('dmail_mailerengine_invoke_now') . '</strong></a></p>';
$out = '<p>' . $this->getLanguageService()->getLL('dmail_mailerengine_manual_explain') . '<br /><br /><a class="t3-link" href="' . BackendUtility::getModuleUrl('DirectMailNavFrame_MailerEngine') . '&id=' . $this->id . '&invokeMailerEngine=1"><strong>' . $this->getLanguageService()->getLL('dmail_mailerengine_invoke_now') . '</strong></a></p>';
$invokeMessage .= '<div style="padding-top: 20px;"></div>';
$invokeMessage .= $this->doc->section(BackendUtility::cshItem($this->cshTable,'mailerengine_invoke',$GLOBALS["BACK_PATH"]) . $this->getLanguageService()->getLL('dmail_mailerengine_manual_invoke'), $out, 1, 1, 0, TRUE);
$invokeMessage .= '<div style="padding-top: 20px;"></div>';
Expand Down Expand Up @@ -409,7 +445,7 @@ function deleteLink($uid) {
$icon = $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL);
$dmail = BackendUtility::getRecord('sys_dmail', $uid);
if (!$dmail['scheduled_begin']) {
return '<a href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM5') . '&id=' . $this->id . '&cmd=delete&uid=' . $uid . '">' . $icon . '</a>';
return '<a href="' . BackendUtility::getModuleUrl('DirectMailNavFrame_MailerEngine') . '&id=' . $this->id . '&cmd=delete&uid=' . $uid . '">' . $icon . '</a>';
}
return "";
}
Expand Down
Loading

0 comments on commit 27935f8

Please sign in to comment.