... | ... |
@@ -101,7 +101,7 @@ $GLOBALS['TL_DCA']['tl_memberfiles_config'] = [ |
101 | 101 |
'exclude' => true, |
102 | 102 |
'inputType' => 'text', |
103 | 103 |
'eval' => ['mandatory' => true, 'tl_class' => 'w50', 'maxlength' => 64, 'preserveTags' => true, 'decodeEntities' => true, 'placeholder' => &$GLOBALS['TL_LANG']['tl_memberfiles_config']['regexp']['placeholder']], |
104 |
- 'sql' => ['type' => 'string', 'length' => 64, 'notnull' => false] |
|
104 |
+ 'sql' => ['type' => 'string', 'length' => 64, 'default' => ''] |
|
105 | 105 |
], |
106 | 106 |
'fields' => [ |
107 | 107 |
'exclude' => true, |
... | ... |
@@ -66,7 +66,7 @@ $GLOBALS['TL_DCA']['tl_memberfiles_config'] = [ |
66 | 66 |
], |
67 | 67 |
'palettes' => [ |
68 | 68 |
'__selector__' => ['hasNotification'], |
69 |
- 'default' => '{title_legend},title;{config_legend},source,target,regexp,fields,hasNotification;{enabled_legend},enabled}', |
|
69 |
+ 'default' => '{title_legend},title;{config_legend},source,target,regexp,fields,hasNotification;{enabled_legend},enabled', |
|
70 | 70 |
], |
71 | 71 |
'subpalettes' => [ |
72 | 72 |
'hasNotification' => 'notification', |
... | ... |
@@ -53,6 +53,11 @@ $GLOBALS['TL_DCA']['tl_memberfiles_config'] = [ |
53 | 53 |
'icon' => 'delete.svg', |
54 | 54 |
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"' |
55 | 55 |
], |
56 |
+ 'toggle' => [ |
|
57 |
+ 'href' => 'act=toggle&field=enabled', |
|
58 |
+ 'icon' => 'visible.svg', |
|
59 |
+ 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"' |
|
60 |
+ ], |
|
56 | 61 |
'show' => [ |
57 | 62 |
'href' => 'act=show', |
58 | 63 |
'icon' => 'show.svg' |
... | ... |
@@ -61,7 +66,7 @@ $GLOBALS['TL_DCA']['tl_memberfiles_config'] = [ |
61 | 66 |
], |
62 | 67 |
'palettes' => [ |
63 | 68 |
'__selector__' => ['hasNotification'], |
64 |
- 'default' => '{title_legend},title;{config_legend},source,target,regexp,fields,hasNotification', |
|
69 |
+ 'default' => '{title_legend},title;{config_legend},source,target,regexp,fields,hasNotification;{enabled_legend},enabled}', |
|
65 | 70 |
], |
66 | 71 |
'subpalettes' => [ |
67 | 72 |
'hasNotification' => 'notification', |
... | ... |
@@ -116,5 +121,13 @@ $GLOBALS['TL_DCA']['tl_memberfiles_config'] = [ |
116 | 121 |
'eval' => ['mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'], |
117 | 122 |
'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0] |
118 | 123 |
], |
124 |
+ 'enabled' => [ |
|
125 |
+ 'exclude' => true, |
|
126 |
+ 'toggle' => true, |
|
127 |
+ 'inputType' => 'checkbox', |
|
128 |
+ 'eval' => ['tl_class' => 'w50'], |
|
129 |
+ 'sql' => ['type' => 'string', 'length' => 1, 'fixed' => true, 'default' => ''] |
|
130 |
+ ], |
|
131 |
+ |
|
119 | 132 |
] |
120 | 133 |
]; |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,120 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Memberfiles for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2017 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license commercial |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+use Contao\DataContainer; |
|
12 |
+use Contao\DC_Table; |
|
13 |
+ |
|
14 |
+$GLOBALS['TL_DCA']['tl_memberfiles_config'] = [ |
|
15 |
+ 'config' => [ |
|
16 |
+ 'dataContainer' => DC_Table::class, |
|
17 |
+ 'enableVersioning' => true, |
|
18 |
+ 'sql' => [ |
|
19 |
+ 'keys' => [ |
|
20 |
+ 'id' => 'primary' |
|
21 |
+ ] |
|
22 |
+ ] |
|
23 |
+ ], |
|
24 |
+ 'list' => [ |
|
25 |
+ 'sorting' => [ |
|
26 |
+ 'mode' => DataContainer::MODE_SORTED, |
|
27 |
+ 'fields' => ['title'], |
|
28 |
+ 'flag' => DataContainer::SORT_INITIAL_LETTER_ASC, |
|
29 |
+ 'panelLayout' => 'filter;search,limit' |
|
30 |
+ ], |
|
31 |
+ 'label' => [ |
|
32 |
+ 'fields' => ['title'], |
|
33 |
+ 'format' => '%s' |
|
34 |
+ ], |
|
35 |
+ 'global_operations' => [ |
|
36 |
+ 'all' => [ |
|
37 |
+ 'href' => 'act=select', |
|
38 |
+ 'class' => 'header_edit_all', |
|
39 |
+ 'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"' |
|
40 |
+ ] |
|
41 |
+ ], |
|
42 |
+ 'operations' => [ |
|
43 |
+ 'edit' => [ |
|
44 |
+ 'href' => 'act=edit', |
|
45 |
+ 'icon' => 'edit.svg' |
|
46 |
+ ], |
|
47 |
+ 'copy' => [ |
|
48 |
+ 'href' => 'act=copy', |
|
49 |
+ 'icon' => 'copy.svg' |
|
50 |
+ ], |
|
51 |
+ 'delete' => [ |
|
52 |
+ 'href' => 'act=delete', |
|
53 |
+ 'icon' => 'delete.svg', |
|
54 |
+ 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"' |
|
55 |
+ ], |
|
56 |
+ 'show' => [ |
|
57 |
+ 'href' => 'act=show', |
|
58 |
+ 'icon' => 'show.svg' |
|
59 |
+ ] |
|
60 |
+ ] |
|
61 |
+ ], |
|
62 |
+ 'palettes' => [ |
|
63 |
+ '__selector__' => ['hasNotification'], |
|
64 |
+ 'default' => '{title_legend},title;{config_legend},source,target,regexp,fields,hasNotification', |
|
65 |
+ ], |
|
66 |
+ 'subpalettes' => [ |
|
67 |
+ 'hasNotification' => 'notification', |
|
68 |
+ ], |
|
69 |
+ 'fields' => [ |
|
70 |
+ 'id' => [ |
|
71 |
+ 'sql' => ['type' => 'integer', 'unsigned' => true, 'autoincrement' => true] |
|
72 |
+ ], |
|
73 |
+ 'tstamp' => [ |
|
74 |
+ 'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0] |
|
75 |
+ ], |
|
76 |
+ 'title' => [ |
|
77 |
+ 'inputType' => 'text', |
|
78 |
+ 'exclude' => true, |
|
79 |
+ 'search' => true, |
|
80 |
+ 'eval' => ['mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'], |
|
81 |
+ 'sql' => ['type' => 'string', 'length' => 255, 'default' => ''] |
|
82 |
+ ], |
|
83 |
+ 'source' => [ |
|
84 |
+ 'exclude' => true, |
|
85 |
+ 'inputType' => 'fileTree', |
|
86 |
+ 'eval' => ['mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'], |
|
87 |
+ 'sql' => ['type' => 'binary', 'length' => 16, 'fixed' => true, 'notnull'=> false] |
|
88 |
+ ], |
|
89 |
+ 'target' => [ |
|
90 |
+ 'exclude' => true, |
|
91 |
+ 'inputType' => 'fileTree', |
|
92 |
+ 'eval' => ['mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'], |
|
93 |
+ 'sql' => ['type' => 'binary', 'length' => 16, 'fixed' => true, 'notnull'=> false] |
|
94 |
+ ], |
|
95 |
+ 'regexp' => [ |
|
96 |
+ 'exclude' => true, |
|
97 |
+ 'inputType' => 'text', |
|
98 |
+ 'eval' => ['mandatory' => true, 'tl_class' => 'w50', 'maxlength' => 64, 'preserveTags' => true, 'decodeEntities' => true, 'placeholder' => &$GLOBALS['TL_LANG']['tl_memberfiles_config']['regexp']['placeholder']], |
|
99 |
+ 'sql' => ['type' => 'string', 'length' => 64, 'notnull' => false] |
|
100 |
+ ], |
|
101 |
+ 'fields' => [ |
|
102 |
+ 'exclude' => true, |
|
103 |
+ 'inputType' => 'checkboxWizard', |
|
104 |
+ 'eval' => ['mandatory' => true, 'multiple' => true, 'tl_class' => 'clr'], |
|
105 |
+ 'sql' => ['type' => 'blob', 'notnull' => false] |
|
106 |
+ ], |
|
107 |
+ 'hasNotification' => [ |
|
108 |
+ 'exclude' => true, |
|
109 |
+ 'inputType' => 'checkbox', |
|
110 |
+ 'eval' => ['submitOnChange' => true, 'tl_class' => 'w50'], |
|
111 |
+ 'sql' => ['type' => 'string', 'length' => 1, 'fixed' => true, 'default' => ''] |
|
112 |
+ ], |
|
113 |
+ 'notification' => [ |
|
114 |
+ 'exclude' => true, |
|
115 |
+ 'inputType' => 'select', |
|
116 |
+ 'eval' => ['mandatory' => true, 'includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'], |
|
117 |
+ 'sql' => ['type' => 'integer', 'unsigned' => true, 'default' => 0] |
|
118 |
+ ], |
|
119 |
+ ] |
|
120 |
+]; |