From fac0116ecf650105cdbebddc04df54d233c0683a Mon Sep 17 00:00:00 2001 From: wunschtacho Date: Sun, 6 Feb 2011 20:22:16 +0000 Subject: [PATCH] Start with Scheduler integration git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/powermail/trunk@43180 735d13b6-9817-0410-8766-e36946ffe9aa --- cli/class.tx_powermail_scheduler.php | 19 +++++++ cli/class.tx_powermail_scheduler_addField.php | 55 +++++++++++++++++++ ext_autoload.php | 46 +++++++++------- ext_localconf.php | 10 +++- 4 files changed, 108 insertions(+), 22 deletions(-) create mode 100644 cli/class.tx_powermail_scheduler.php create mode 100644 cli/class.tx_powermail_scheduler_addField.php diff --git a/cli/class.tx_powermail_scheduler.php b/cli/class.tx_powermail_scheduler.php new file mode 100644 index 00000000..8b36fcfd --- /dev/null +++ b/cli/class.tx_powermail_scheduler.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/cli/class.tx_powermail_scheduler_addField.php b/cli/class.tx_powermail_scheduler_addField.php new file mode 100644 index 00000000..5c81d1cd --- /dev/null +++ b/cli/class.tx_powermail_scheduler_addField.php @@ -0,0 +1,55 @@ +CMD == 'edit') { + $taskInfo['ip'] = $task->ip; + } else { + $taskInfo['ip'] = ''; + } + } + + if (empty($taskInfo['port'])) { + if($parentObject->CMD == 'add') { + $taskInfo['port'] = '80'; + } elseif($parentObject->CMD == 'edit') { + $taskInfo['port'] = $task->port; + } else { + $taskInfo['port'] = ''; + } + } + + // Write the code for the field + $fieldID = 'task_ip'; + $fieldCode = ''; + $additionalFields = array(); + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'IP-Adresse/Webseite' + ); + + // Write the code for the field + $fieldID = 'task_port'; + $fieldCode = ''; + $additionalFields[$fieldID] = array( + 'code' => $fieldCode, + 'label' => 'Port' + ); + + return $additionalFields; + } + + public function validateAdditionalFields(array &$submittedData, tx_scheduler_Module $parentObject) { + $submittedData['ip'] = trim($submittedData['ip']); + $submittedData['port'] = trim($submittedData['port']); + return true; + } + + public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) { + $task->ip = $submittedData['ip']; + $task->port = $submittedData['port']; + } +} +?> \ No newline at end of file diff --git a/ext_autoload.php b/ext_autoload.php index 1ea893a1..daf78f1a 100644 --- a/ext_autoload.php +++ b/ext_autoload.php @@ -1,21 +1,25 @@ - $powermailExtPath . 'mod1/class.tx_powermail_action.php', - - /* ajax repositories */ - 'tx_powermail_repository' => $powermailExtPath . 'mod1/class.tx_powermail_repository.php', - 'tx_powermail_export' => $powermailExtPath . 'mod1/class.tx_powermail_export.php', - - /* div */ - 'tx_powermail_functions_div' => $powermailExtPath . 'lib/class.tx_powermail_functions_div.php', - -); -?> + $powermailExtPath . 'mod1/class.tx_powermail_action.php', + + /* ajax repositories */ + 'tx_powermail_repository' => $powermailExtPath . 'mod1/class.tx_powermail_repository.php', + 'tx_powermail_export' => $powermailExtPath . 'mod1/class.tx_powermail_export.php', + + /* div */ + 'tx_powermail_functions_div' => $powermailExtPath . 'lib/class.tx_powermail_functions_div.php', + + /* scheduler */ + 'tx_powermail_scheduler' => $powermailExtPath . 'cli/class.tx_powermail_scheduler.php', + 'tx_powermail_scheduler_addField' => $powermailExtPath . 'cli/class.tx_powermail_scheduler_addField.php' + +); +?> diff --git a/ext_localconf.php b/ext_localconf.php index de11526d..fe016933 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -7,7 +7,7 @@ include_once(t3lib_extMgm::extPath('powermail') . 'lib/class.user_powermail_tx_powermail_fieldsetchoose.php'); } -$TYPO3_CONF_VARS['BE']['AJAX']['tx_powermail::controller'] = 'EXT:powermail/mod1/class.tx_powermail_ajax.php:tx_powermail_Ajax->ajaxController'; +$TYPO3_CONF_VARS['BE']['AJAX']['tx_powermail::controller'] = 'EXT:powermail/mod1/class.tx_powermail_ajax.php:tx_powermail_Ajax->ajaxController'; $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['powermail']); // Get backend config include_once(t3lib_extMgm::extPath('powermail') . 'lib/user_powermailOnCurrentPage.php'); // Conditions for JS including @@ -28,4 +28,12 @@ 'icon' => TRUE, ); +/* SCHEDULER SETTINGS */ +$TYPO3_CONF_VARS['SC_OPTIONS']['scheduler']['tasks']['tx_powermail_scheduler'] = array( + 'extension' => 'powermail', + 'title' => 'Automatic Export Mails', + 'description' => 'Send your CSV or XLS exports via Email to a defined target', + 'additionalFields' => 'tx_powermail_scheduler_addField' +); + ?> \ No newline at end of file