Refine survey editor workflow and publication handling
This commit is contained in:
@@ -22,6 +22,8 @@ $GLOBALS['TL_DCA']['tl_survey'] = [
|
||||
'id' => 'primary',
|
||||
'alias' => 'unique',
|
||||
'published' => 'index',
|
||||
'isActive' => 'index',
|
||||
'isTemplate' => 'index',
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -33,7 +35,7 @@ $GLOBALS['TL_DCA']['tl_survey'] = [
|
||||
'panelLayout' => 'filter;sort,search,limit',
|
||||
],
|
||||
'label' => [
|
||||
'fields' => ['title', 'categorySummary', 'assignedMembersSummary'],
|
||||
'fields' => ['title', 'categorySummary', 'assignedMembersSummary', 'templateSummary'],
|
||||
'showColumns' => true,
|
||||
],
|
||||
'global_operations' => [
|
||||
@@ -52,10 +54,22 @@ $GLOBALS['TL_DCA']['tl_survey'] = [
|
||||
'href' => 'act=edit',
|
||||
'icon' => 'header.svg',
|
||||
],
|
||||
'publishSurvey' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['publishSurvey'],
|
||||
'href' => 'act=toggle&field=published',
|
||||
'icon' => 'visible.svg',
|
||||
'button_callback' => [SurveyDcaListener::class, 'generatePublishSurveyButton'],
|
||||
],
|
||||
'toggleActive' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['toggleActive'],
|
||||
'href' => 'act=toggle&field=isActive',
|
||||
'icon' => 'visible.svg',
|
||||
'button_callback' => [SurveyDcaListener::class, 'generateToggleActiveButton'],
|
||||
],
|
||||
'delete' => [
|
||||
'href' => 'act=delete',
|
||||
'icon' => 'delete.svg',
|
||||
'attributes' => 'onclick="if(!confirm(\'Eintrag wirklich loeschen?\'))return false;Backend.getScrollOffset()"',
|
||||
'attributes' => 'onclick="if(!confirm(\'Eintrag wirklich löschen?\'))return false;Backend.getScrollOffset()"',
|
||||
],
|
||||
'show' => [
|
||||
'href' => 'act=show',
|
||||
@@ -74,7 +88,7 @@ $GLOBALS['TL_DCA']['tl_survey'] = [
|
||||
],
|
||||
],
|
||||
'palettes' => [
|
||||
'default' => '{title_legend},title,category,description;{assignment_legend},assignedMembers;{publishing_legend},published,isLocked;{meta_legend},createdAt,updatedAt',
|
||||
'default' => '{title_legend},title,category,description;{assignment_legend},assignedMembers;{publishing_legend},isTemplate;{meta_legend},createdAt,updatedAt',
|
||||
],
|
||||
'fields' => [
|
||||
'id' => [
|
||||
@@ -105,6 +119,7 @@ $GLOBALS['TL_DCA']['tl_survey'] = [
|
||||
],
|
||||
'category' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['category'],
|
||||
'filter' => true,
|
||||
'inputType' => 'select',
|
||||
'foreignKey' => 'tl_survey_category.title',
|
||||
'eval' => ['multiple' => true, 'chosen' => true, 'tl_class' => 'clr'],
|
||||
@@ -113,9 +128,8 @@ $GLOBALS['TL_DCA']['tl_survey'] = [
|
||||
],
|
||||
'categoryFilter' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['categoryFilter'],
|
||||
'filter' => true,
|
||||
'inputType' => 'select',
|
||||
'options_callback' => [SurveyDcaListener::class, 'getCategoryOptions'],
|
||||
'options_callback' => [SurveyDcaListener::class, 'getUsedCategoryFilterOptions'],
|
||||
'eval' => ['includeBlankOption' => true, 'chosen' => true, 'findInSet' => true],
|
||||
'sql' => "varchar(255) NOT NULL default ''",
|
||||
],
|
||||
@@ -127,8 +141,33 @@ $GLOBALS['TL_DCA']['tl_survey'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['published'],
|
||||
'inputType' => 'checkbox',
|
||||
'eval' => ['tl_class' => 'w50 m12'],
|
||||
'save_callback' => [[SurveyDcaListener::class, 'savePublishedState']],
|
||||
'sql' => "char(1) NOT NULL default ''",
|
||||
],
|
||||
'isActive' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['isActive'],
|
||||
'inputType' => 'checkbox',
|
||||
'save_callback' => [[SurveyDcaListener::class, 'saveActiveState']],
|
||||
'sql' => "char(1) NOT NULL default ''",
|
||||
],
|
||||
'isTemplate' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['isTemplate'],
|
||||
'inputType' => 'checkbox',
|
||||
'eval' => ['tl_class' => 'w50 m12'],
|
||||
'sql' => "char(1) NOT NULL default ''",
|
||||
],
|
||||
'templateFilter' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['templateFilter'],
|
||||
'filter' => true,
|
||||
'inputType' => 'select',
|
||||
'options_callback' => [SurveyDcaListener::class, 'getTemplateFilterOptions'],
|
||||
'eval' => ['includeBlankOption' => true, 'chosen' => true],
|
||||
'sql' => "char(1) NOT NULL default ''",
|
||||
],
|
||||
'templateSummary' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['templateSummary'],
|
||||
'sql' => "varchar(16) NOT NULL default ''",
|
||||
],
|
||||
'isLocked' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_survey']['isLocked'],
|
||||
'inputType' => 'checkbox',
|
||||
@@ -192,7 +231,7 @@ if ('cli' !== PHP_SAPI) {
|
||||
System::getContainer()->get('database_connection')->fetchFirstColumn('SHOW COLUMNS FROM tl_survey'),
|
||||
);
|
||||
$hasListMetadataColumns = !array_diff(
|
||||
['categoryfilter', 'categorysummary', 'assignedmembersfilter', 'assignedmemberssummary'],
|
||||
['categoryfilter', 'categorysummary', 'templatefilter', 'templatesummary', 'assignedmembersfilter', 'assignedmemberssummary'],
|
||||
$columnNames,
|
||||
);
|
||||
} catch (\Throwable) {
|
||||
@@ -205,6 +244,8 @@ if ('cli' !== PHP_SAPI) {
|
||||
unset(
|
||||
$GLOBALS['TL_DCA']['tl_survey']['fields']['categoryFilter'],
|
||||
$GLOBALS['TL_DCA']['tl_survey']['fields']['categorySummary'],
|
||||
$GLOBALS['TL_DCA']['tl_survey']['fields']['templateFilter'],
|
||||
$GLOBALS['TL_DCA']['tl_survey']['fields']['templateSummary'],
|
||||
$GLOBALS['TL_DCA']['tl_survey']['fields']['assignedMembersFilter'],
|
||||
$GLOBALS['TL_DCA']['tl_survey']['fields']['assignedMembersSummary'],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user