Browse code

Remove old root page based configuration fields

Benjamin Roth authored on08/05/2025 14:08:27
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,85 +0,0 @@
1
-<?php
2
-
3
-/**
4
- * Pagelist for Contao
5
- *
6
- * Copyright (c) 2015 Benjamin Roth
7
- *
8
- * @license LGPL-3.0+
9
- */
10
-
11
-use Contao\CoreBundle\DataContainer\PaletteManipulator;
12
-
13
-/**
14
- * Palettes
15
- */
16
-
17
-PaletteManipulator::create()
18
-    ->addLegend('sec_dl_legend', 'publish_legend', PaletteManipulator::POSITION_BEFORE)
19
-    ->addField('secureDownloadsEnabled', 'sec_dl_legend', PaletteManipulator::POSITION_APPEND)
20
-    ->applyToPalette('root', 'tl_page')
21
-    ->applyToPalette('rootfallback', 'tl_page');
22
-
23
-$GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'secureDownloadsEnabled';
24
-$GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'sd_nc_enable';
25
-$GLOBALS['TL_DCA']['tl_page']['subpalettes']['secureDownloadsEnabled'] = 'secureDownloadsSRC,secureDownloadsTarget,secureDownloadsRegExp,secureDownloadsFields,sd_nc_enable';
26
-$GLOBALS['TL_DCA']['tl_page']['subpalettes']['sd_nc_enable'] = 'sd_nc_notification';
27
-
28
-
29
-/**
30
- * Fields
31
- */
32
-$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsEnabled'] = array
33
-(
34
-    'exclude' => true,
35
-    'inputType' => 'checkbox',
36
-    'eval' => array('submitOnChange' => true),
37
-    'sql' => "char(1) NOT NULL default ''"
38
-);
39
-$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsSRC'] = array
40
-(
41
-    'exclude' => true,
42
-    'inputType' => 'fileTree',
43
-    'eval' => array('mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'),
44
-    'sql' => 'binary(16) NULL'
45
-);
46
-
47
-$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsTarget'] = array
48
-(
49
-    'exclude' => true,
50
-    'inputType' => 'fileTree',
51
-    'eval' => array('mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'),
52
-    'sql' => 'binary(16) NULL'
53
-);
54
-
55
-$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsRegExp'] = array
56
-(
57
-    'exclude' => true,
58
-    'inputType' => 'text',
59
-    'eval' => array('mandatory' => true, 'maxlength' => 64, 'preserveTags' => true, 'decodeEntities' => true),
60
-    'sql' => 'varchar(64) NULL'
61
-);
62
-
63
-$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsFields'] = array
64
-(
65
-    'exclude' => true,
66
-    'inputType' => 'checkboxWizard',
67
-    'eval' => array('mandatory' => true, 'multiple' => true),
68
-    'sql' => 'varchar(255) NULL'
69
-);
70
-
71
-$GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_enable'] = array
72
-(
73
-    'exclude' => true,
74
-    'inputType' => 'checkbox',
75
-    'eval' => array('tl_class' => 'w50 m12', 'submitOnChange' => true),
76
-    'sql' => "char(1) NOT NULL default ''"
77
-);
78
-
79
-$GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_notification'] = array
80
-(
81
-    'exclude' => true,
82
-    'inputType' => 'select',
83
-    'eval' => array('mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'),
84
-    'sql' => "int(10) unsigned NOT NULL default '0'"
85
-);
Browse code

Update

Benjamin Roth authored on26/07/2023 15:18:55
Showing1 changed files
... ...
@@ -15,13 +15,15 @@ use Contao\CoreBundle\DataContainer\PaletteManipulator;
15 15
  */
16 16
 
17 17
 PaletteManipulator::create()
18
-    ->addLegend('sec_dl_legend','publish_legend',PaletteManipulator::POSITION_BEFORE)
19
-    ->addField('secureDownloadsEnabled','sec_dl_legend',PaletteManipulator::POSITION_APPEND)
20
-    ->applyToPalette('root','tl_page')
21
-    ->applyToPalette('rootfallback','tl_page');
18
+    ->addLegend('sec_dl_legend', 'publish_legend', PaletteManipulator::POSITION_BEFORE)
19
+    ->addField('secureDownloadsEnabled', 'sec_dl_legend', PaletteManipulator::POSITION_APPEND)
20
+    ->applyToPalette('root', 'tl_page')
21
+    ->applyToPalette('rootfallback', 'tl_page');
22 22
 
23 23
 $GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'secureDownloadsEnabled';
24
-$GLOBALS['TL_DCA']['tl_page']['subpalettes']['secureDownloadsEnabled'] = 'secureDownloadsSRC,secureDownloadsTarget,secureDownloadsRegExp,secureDownloadsFields,sd_nc_enable,sd_nc_notification';
24
+$GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'sd_nc_enable';
25
+$GLOBALS['TL_DCA']['tl_page']['subpalettes']['secureDownloadsEnabled'] = 'secureDownloadsSRC,secureDownloadsTarget,secureDownloadsRegExp,secureDownloadsFields,sd_nc_enable';
26
+$GLOBALS['TL_DCA']['tl_page']['subpalettes']['sd_nc_enable'] = 'sd_nc_notification';
25 27
 
26 28
 
27 29
 /**
... ...
@@ -29,64 +31,55 @@ $GLOBALS['TL_DCA']['tl_page']['subpalettes']['secureDownloadsEnabled'] = 'secure
29 31
  */
30 32
 $GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsEnabled'] = array
31 33
 (
32
-  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsEnabled'],
33
-  'exclude'                 => true,
34
-  'inputType'               => 'checkbox',
35
-  'eval'                    => array('submitOnChange'=>true),
36
-  'sql'                     => "char(1) NOT NULL default ''"
34
+    'exclude' => true,
35
+    'inputType' => 'checkbox',
36
+    'eval' => array('submitOnChange' => true),
37
+    'sql' => "char(1) NOT NULL default ''"
37 38
 );
38 39
 $GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsSRC'] = array
39 40
 (
40
-    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsSRC'],
41
-    'exclude'                 => true,
42
-    'inputType'               => 'fileTree',
43
-    'eval'                    => array('mandatory'=>true,'fieldType'=>'radio', 'tl_class'=>'clr'),
44
-    'sql'                     => 'binary(16) NULL'
41
+    'exclude' => true,
42
+    'inputType' => 'fileTree',
43
+    'eval' => array('mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'),
44
+    'sql' => 'binary(16) NULL'
45 45
 );
46 46
 
47 47
 $GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsTarget'] = array
48 48
 (
49
-  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsTarget'],
50
-  'exclude'                 => true,
51
-  'inputType'               => 'fileTree',
52
-  'eval'                    => array('mandatory'=>true,'fieldType'=>'radio', 'tl_class'=>'clr'),
53
-  'sql'                     => 'binary(16) NULL'
49
+    'exclude' => true,
50
+    'inputType' => 'fileTree',
51
+    'eval' => array('mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'),
52
+    'sql' => 'binary(16) NULL'
54 53
 );
55 54
 
56 55
 $GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsRegExp'] = array
57 56
 (
58
-  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsRegExp'],
59
-  'exclude'                 => true,
60
-  'inputType'               => 'text',
61
-  'eval'                    => array('mandatory'=>true,'maxlength'=>64,'preserveTags'=>true,'decodeEntities'=>true),
62
-  'sql'                     => 'varchar(64) NULL'
57
+    'exclude' => true,
58
+    'inputType' => 'text',
59
+    'eval' => array('mandatory' => true, 'maxlength' => 64, 'preserveTags' => true, 'decodeEntities' => true),
60
+    'sql' => 'varchar(64) NULL'
63 61
 );
64 62
 
65 63
 $GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsFields'] = array
66 64
 (
67
-  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsFields'],
68
-  'exclude'                 => true,
69
-  'inputType'               => 'checkboxWizard',
70
-  'options_callback'        => array('tl_page_eSM_secureDownloads','getMemberProperties'),
71
-  'eval'                    => array('mandatory'=>true,'multiple'=>true),
72
-  'sql'                     => 'varchar(255) NULL'
65
+    'exclude' => true,
66
+    'inputType' => 'checkboxWizard',
67
+    'eval' => array('mandatory' => true, 'multiple' => true),
68
+    'sql' => 'varchar(255) NULL'
73 69
 );
74 70
 
75 71
 $GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_enable'] = array
76 72
 (
77
-  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['sd_nc_enable'],
78
-  'exclude'                 => true,
79
-  'inputType'               => 'checkbox',
80
-  'eval'                    => array('tl_class'=>'w50 m12','submitOnChange'=>true),
81
-  'sql'                     => "char(1) NOT NULL default ''"
73
+    'exclude' => true,
74
+    'inputType' => 'checkbox',
75
+    'eval' => array('tl_class' => 'w50 m12', 'submitOnChange' => true),
76
+    'sql' => "char(1) NOT NULL default ''"
82 77
 );
83 78
 
84 79
 $GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_notification'] = array
85 80
 (
86
-  'label'                     => &$GLOBALS['TL_LANG']['tl_page']['sd_nc_enable'],
87
-  'exclude'                   => true,
88
-  'inputType'                 => 'select',
89
-  'options_callback'          => array('tl_page_eSM_secureDownloads', 'getNotificationChoices'),
90
-  'eval'                      => array('mandatory'=>true,'includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'),
91
-  'sql'                       => "int(10) unsigned NOT NULL default '0'"
81
+    'exclude' => true,
82
+    'inputType' => 'select',
83
+    'eval' => array('mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'),
84
+    'sql' => "int(10) unsigned NOT NULL default '0'"
92 85
 );
Browse code

Update

Benjamin Roth authored on26/07/2023 13:13:48
Showing1 changed files
... ...
@@ -8,11 +8,19 @@
8 8
  * @license LGPL-3.0+
9 9
  */
10 10
 
11
+use Contao\CoreBundle\DataContainer\PaletteManipulator;
12
+
11 13
 /**
12 14
  * Palettes
13 15
  */
16
+
17
+PaletteManipulator::create()
18
+    ->addLegend('sec_dl_legend','publish_legend',PaletteManipulator::POSITION_BEFORE)
19
+    ->addField('secureDownloadsEnabled','sec_dl_legend',PaletteManipulator::POSITION_APPEND)
20
+    ->applyToPalette('root','tl_page')
21
+    ->applyToPalette('rootfallback','tl_page');
22
+
14 23
 $GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'secureDownloadsEnabled';
15
-$GLOBALS['TL_DCA']['tl_page']['palettes']['root'] = str_replace(';{publish_legend}', ';{sec_dl_legend},secureDownloadsEnabled;{publish_legend}',$GLOBALS['TL_DCA']['tl_page']['palettes']['root']);
16 24
 $GLOBALS['TL_DCA']['tl_page']['subpalettes']['secureDownloadsEnabled'] = 'secureDownloadsSRC,secureDownloadsTarget,secureDownloadsRegExp,secureDownloadsFields,sd_nc_enable,sd_nc_notification';
17 25
 
18 26
 
... ...
@@ -82,55 +90,3 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_notification'] = array
82 90
   'eval'                      => array('mandatory'=>true,'includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'),
83 91
   'sql'                       => "int(10) unsigned NOT NULL default '0'"
84 92
 );
85
-
86
-class tl_page_eSM_secureDownloads extends \Backend
87
-{
88
-  /**
89
-   * Import the back end user object
90
-   */
91
-  public function __construct()
92
-  {
93
-    parent::__construct();
94
-    $this->import('BackendUser', 'User');
95
-  }
96
-
97
-  /**
98
-   * Return all fields of table tl_member
99
-   *
100
-   * @return array
101
-   */
102
-  public function getMemberProperties()
103
-  {
104
-    $return = array('id'=>'ID');
105
-
106
-    System::loadLanguageFile('tl_member');
107
-    $this->loadDataContainer('tl_member');
108
-
109
-    foreach ($GLOBALS['TL_DCA']['tl_member']['fields'] as $k=>$v)
110
-    {
111
-      if (is_array($v['label']))
112
-      {
113
-        $return[$k] = $GLOBALS['TL_DCA']['tl_member']['fields'][$k]['label'][0];
114
-      }
115
-    }
116
-
117
-    return $return;
118
-  }
119
-
120
-  /**
121
-   * Get notification choices
122
-   *
123
-   * @return array
124
-   */
125
-  public function getNotificationChoices()
126
-  {
127
-    $arrChoices = array();
128
-    $objNotifications = \Database::getInstance()->execute("SELECT id,title FROM tl_nc_notification WHERE type='secDownloads_submitted' ORDER BY title");
129
-
130
-    while ($objNotifications->next()) {
131
-      $arrChoices[$objNotifications->id] = $objNotifications->title;
132
-    }
133
-
134
-    return $arrChoices;
135
-  }
136
-}
137 93
\ No newline at end of file
Browse code

Add dcas

Benjamin Roth authored on17/07/2023 12:21:01
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,136 @@
1
+<?php
2
+
3
+/**
4
+ * Pagelist for Contao
5
+ *
6
+ * Copyright (c) 2015 Benjamin Roth
7
+ *
8
+ * @license LGPL-3.0+
9
+ */
10
+
11
+/**
12
+ * Palettes
13
+ */
14
+$GLOBALS['TL_DCA']['tl_page']['palettes']['__selector__'][] = 'secureDownloadsEnabled';
15
+$GLOBALS['TL_DCA']['tl_page']['palettes']['root'] = str_replace(';{publish_legend}', ';{sec_dl_legend},secureDownloadsEnabled;{publish_legend}',$GLOBALS['TL_DCA']['tl_page']['palettes']['root']);
16
+$GLOBALS['TL_DCA']['tl_page']['subpalettes']['secureDownloadsEnabled'] = 'secureDownloadsSRC,secureDownloadsTarget,secureDownloadsRegExp,secureDownloadsFields,sd_nc_enable,sd_nc_notification';
17
+
18
+
19
+/**
20
+ * Fields
21
+ */
22
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsEnabled'] = array
23
+(
24
+  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsEnabled'],
25
+  'exclude'                 => true,
26
+  'inputType'               => 'checkbox',
27
+  'eval'                    => array('submitOnChange'=>true),
28
+  'sql'                     => "char(1) NOT NULL default ''"
29
+);
30
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsSRC'] = array
31
+(
32
+    'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsSRC'],
33
+    'exclude'                 => true,
34
+    'inputType'               => 'fileTree',
35
+    'eval'                    => array('mandatory'=>true,'fieldType'=>'radio', 'tl_class'=>'clr'),
36
+    'sql'                     => 'binary(16) NULL'
37
+);
38
+
39
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsTarget'] = array
40
+(
41
+  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsTarget'],
42
+  'exclude'                 => true,
43
+  'inputType'               => 'fileTree',
44
+  'eval'                    => array('mandatory'=>true,'fieldType'=>'radio', 'tl_class'=>'clr'),
45
+  'sql'                     => 'binary(16) NULL'
46
+);
47
+
48
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsRegExp'] = array
49
+(
50
+  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsRegExp'],
51
+  'exclude'                 => true,
52
+  'inputType'               => 'text',
53
+  'eval'                    => array('mandatory'=>true,'maxlength'=>64,'preserveTags'=>true,'decodeEntities'=>true),
54
+  'sql'                     => 'varchar(64) NULL'
55
+);
56
+
57
+$GLOBALS['TL_DCA']['tl_page']['fields']['secureDownloadsFields'] = array
58
+(
59
+  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['secureDownloadsFields'],
60
+  'exclude'                 => true,
61
+  'inputType'               => 'checkboxWizard',
62
+  'options_callback'        => array('tl_page_eSM_secureDownloads','getMemberProperties'),
63
+  'eval'                    => array('mandatory'=>true,'multiple'=>true),
64
+  'sql'                     => 'varchar(255) NULL'
65
+);
66
+
67
+$GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_enable'] = array
68
+(
69
+  'label'                   => &$GLOBALS['TL_LANG']['tl_page']['sd_nc_enable'],
70
+  'exclude'                 => true,
71
+  'inputType'               => 'checkbox',
72
+  'eval'                    => array('tl_class'=>'w50 m12','submitOnChange'=>true),
73
+  'sql'                     => "char(1) NOT NULL default ''"
74
+);
75
+
76
+$GLOBALS['TL_DCA']['tl_page']['fields']['sd_nc_notification'] = array
77
+(
78
+  'label'                     => &$GLOBALS['TL_LANG']['tl_page']['sd_nc_enable'],
79
+  'exclude'                   => true,
80
+  'inputType'                 => 'select',
81
+  'options_callback'          => array('tl_page_eSM_secureDownloads', 'getNotificationChoices'),
82
+  'eval'                      => array('mandatory'=>true,'includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'w50'),
83
+  'sql'                       => "int(10) unsigned NOT NULL default '0'"
84
+);
85
+
86
+class tl_page_eSM_secureDownloads extends \Backend
87
+{
88
+  /**
89
+   * Import the back end user object
90
+   */
91
+  public function __construct()
92
+  {
93
+    parent::__construct();
94
+    $this->import('BackendUser', 'User');
95
+  }
96
+
97
+  /**
98
+   * Return all fields of table tl_member
99
+   *
100
+   * @return array
101
+   */
102
+  public function getMemberProperties()
103
+  {
104
+    $return = array('id'=>'ID');
105
+
106
+    System::loadLanguageFile('tl_member');
107
+    $this->loadDataContainer('tl_member');
108
+
109
+    foreach ($GLOBALS['TL_DCA']['tl_member']['fields'] as $k=>$v)
110
+    {
111
+      if (is_array($v['label']))
112
+      {
113
+        $return[$k] = $GLOBALS['TL_DCA']['tl_member']['fields'][$k]['label'][0];
114
+      }
115
+    }
116
+
117
+    return $return;
118
+  }
119
+
120
+  /**
121
+   * Get notification choices
122
+   *
123
+   * @return array
124
+   */
125
+  public function getNotificationChoices()
126
+  {
127
+    $arrChoices = array();
128
+    $objNotifications = \Database::getInstance()->execute("SELECT id,title FROM tl_nc_notification WHERE type='secDownloads_submitted' ORDER BY title");
129
+
130
+    while ($objNotifications->next()) {
131
+      $arrChoices[$objNotifications->id] = $objNotifications->title;
132
+    }
133
+
134
+    return $arrChoices;
135
+  }
136
+}
0 137
\ No newline at end of file