Browse code

Updates

Benjamin Roth authored on21/03/2023 16:40:45
Showing2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,54 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of newsmailer bundle for Contao.
5
+ *
6
+ * (c) Benjamin Roth
7
+ *
8
+ * @license LGPL-3.0-or-later
9
+ */
10
+
11
+use Contao\CoreBundle\DataContainer\PaletteManipulator;
12
+
13
+/**
14
+ * Palettes
15
+ */
16
+
17
+//$GLOBALS['TL_DCA']['tl_news']['palettes']['default'] = str_replace(array('{publish_legend}','{publish_legend:hide}'),array('{nc_legend:hide},nc_sent,nc_testmail;{publish_legend}','{nc_legend:hide},nc_sent,nc_testmail;{publish_legend:hide}'),$GLOBALS['TL_DCA']['tl_news']['palettes']['default']);
18
+PaletteManipulator::create()
19
+    ->addLegend('nc_legend','publish_legend',PaletteManipulator::POSITION_BEFORE)
20
+    ->addField('nc_sent','nc_legend', PaletteManipulator::POSITION_APPEND)
21
+    ->addField('nc_testmail','nc_legend', PaletteManipulator::POSITION_APPEND)
22
+    ->applyToPalette('default','tl_news')
23
+;
24
+
25
+/**
26
+ * Fields
27
+ */
28
+
29
+$GLOBALS['TL_DCA']['tl_member']['fields']['nc_news_subscribe'] = array
30
+(
31
+    'exclude'                 => true,
32
+    'inputType'               => 'checkbox',
33
+    'eval'                    => array('tl_class'=>'w50 m12', 'doNotCopy'=>true, 'feEditable'=>true, 'feViewable'=>true, 'feGroup'=>'contact'),
34
+    'save_callback'           => array
35
+    (
36
+        array('tl_member_eSM_nc_news', 'setNcNewsChangedate'),
37
+    ),
38
+    'sql'                     => "char(1) NOT NULL default '1'"
39
+);
40
+
41
+$GLOBALS['TL_DCA']['tl_member']['fields']['nc_news_subscribe_changed'] = array
42
+(
43
+    'eval'                    => array('rgxp'=>'datim'),
44
+    'sql'                     => "int(10) unsigned NOT NULL default '0'"
45
+);
46
+
47
+$GLOBALS['TL_DCA']['tl_member']['fields']['nc_news_additionalEmail'] = array
48
+(
49
+    'exclude'                 => true,
50
+    'search'                  => true,
51
+    'inputType'               => 'text',
52
+    'eval'                    => array('mandatory'=>false, 'maxlength'=>1022, 'rgxp'=>'emails', 'tl_class'=>'w50', 'feEditable'=>true, 'feViewable'=>true, 'feGroup'=>'contact'),
53
+    'sql'                     => "varchar(1022) NOT NULL default ''"
54
+);
... ...
@@ -53,7 +53,7 @@ class NewsSendTestmailListener
53 53
 
54 54
                 if (($objJumpTo = $Archive->getRelated('jumpTo')) !== null)
55 55
                 {
56
-                    $arrRow['url'] = $objJumpTo->getAbsoluteUrl(Config::get('useAutoItem') ? '/%s' : '/items/%s').'?ltoken=%%_TOKEN_%%';
56
+                    $arrRow['url'] = $objJumpTo->getAbsoluteUrl(sprintf((Config::get('useAutoItem') ? '/%s' : '/items/%s'),$News->alias)).'?ltoken=%%_TOKEN_%%';
57 57
                 }
58 58
 
59 59
                 $arrNewsPlain[] = date('d.m.Y',$News->date).' - '.$News->headline;