Skip to content

Commit

Permalink
AdminUI: Convert Mail Accounts page civicrm/admin/mailSettings
Browse files Browse the repository at this point in the history
Make MailSettings available to SearchKit
  • Loading branch information
aydun committed Jul 4, 2023
1 parent 6e33ac4 commit 0e297e0
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CRM/Mailing/xml/Menu/Mailing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
<path>civicrm/admin/mailSettings</path>
<title>Mail Accounts</title>
<page_callback>CRM_Admin_Page_MailSettings</page_callback>
<desc>List email accounts.</desc>
<access_arguments>access CiviCRM,access CiviMail</access_arguments>
<adminGroup>CiviMail</adminGroup>
<weight>420</weight>
</item>
<item>
<path>civicrm/admin/mailSettings/edit</path>
<title>Mail Accounts</title>
<page_callback>CRM_Admin_Page_MailSettings</page_callback>
<desc>Configure email account setting.</desc>
<access_arguments>access CiviCRM,access CiviMail</access_arguments>
<adminGroup>CiviMail</adminGroup>
Expand Down
2 changes: 1 addition & 1 deletion ext/civi_mail/Civi/Api4/MailSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* MailSettings entity.
*
* @searchable none
* @searchable secondary
* @since 5.19
* @package Civi\Api4
*/
Expand Down
3 changes: 3 additions & 0 deletions ext/civicrm_admin_ui/ang/afsearchMailAccounts.aff.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div af-fieldset="">
<crm-search-display-table search-name="Mail_Accounts" display-name="Mail_Accounts_Table_1"></crm-search-display-table>
</div>
19 changes: 19 additions & 0 deletions ext/civicrm_admin_ui/ang/afsearchMailAccounts.aff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "search",
"title": "Mail Accounts",
"icon": "fa-list-alt",
"server_route": "civicrm/admin/mailSettings",
"permission": "administer CiviCRM",
"requires": [],
"description": "",
"is_dashlet": false,
"is_public": false,
"is_token": false,
"entity_type": null,
"join_entity": null,
"contact_summary": null,
"summary_contact_type": null,
"redirect": null,
"create_submission": null,
"navigation": null
}
194 changes: 194 additions & 0 deletions ext/civicrm_admin_ui/managed/SavedSearch_Manage_Mail_Accounts.mgd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
<?php

use CRM_CivicrmAdminUi_ExtensionUtil as E;

return [
[
'name' => 'SavedSearch_Mail_Accounts',
'entity' => 'SavedSearch',
'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'Mail_Accounts',
'label' => E::ts('Mail Accounts'),
'form_values' => NULL,
'mapping_id' => NULL,
'search_custom_id' => NULL,
'api_entity' => 'MailSettings',
'api_params' => [
'version' => 4,
'select' => [
'name',
'server',
'username',
'localpart',
'domain',
'return_path',
'protocol:label',
'source',
'is_ssl',
'is_default',
],
'orderBy' => [],
'where' => [],
'groupBy' => [],
'join' => [],
'having' => [],
],
'expires_date' => NULL,
'description' => NULL,
],
'match' => [
'name',
],
],
],
[
'name' => 'SavedSearch_Mail_Accounts_SearchDisplay_Mail_Accounts_Table_1',
'entity' => 'SearchDisplay',
'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'Mail_Accounts_Table_1',
'label' => E::ts('Mail Accounts Table 1'),
'saved_search_id.name' => 'Mail_Accounts',
'type' => 'table',
'settings' => [
'description' => NULL,
'sort' => [],
'limit' => 50,
'pager' => [],
'placeholder' => 5,
'columns' => [
[
'type' => 'field',
'key' => 'name',
'dataType' => 'String',
'label' => E::ts('Name'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'server',
'dataType' => 'String',
'label' => E::ts('Server'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'username',
'dataType' => 'String',
'label' => E::ts('Username'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'localpart',
'dataType' => 'String',
'label' => E::ts('Localpart'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'domain',
'dataType' => 'String',
'label' => E::ts('Domain'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'return_path',
'dataType' => 'String',
'label' => E::ts('Return-Path'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'protocol:label',
'dataType' => 'String',
'label' => E::ts('Protocol'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'source',
'dataType' => 'String',
'label' => E::ts('Mail Folder'),
'sortable' => TRUE,
],
[
'type' => 'field',
'key' => 'is_ssl',
'dataType' => 'Boolean',
'label' => E::ts('Use SSL?'),
'sortable' => TRUE,
],
[
'type' => 'html',
'key' => 'is_default',
'dataType' => 'Boolean',
'label' => E::ts('Used For'),
'sortable' => TRUE,
'rewrite' => "{if '[is_default]' == 'Yes'}" . E::ts("Bounce Processing <strong>(Default)</strong>") . "{else}" . E::ts("Email-to-Activity") . "{/if}",
],
[
'text' => '',
'style' => 'default',
'size' => 'btn-xs',
'icon' => 'fa-bars',
'links' => [
[
'entity' => 'MailSettings',
'action' => 'update',
'join' => '',
'target' => 'crm-popup',
'icon' => 'fa-pencil',
'text' => E::ts('Edit'),
'style' => 'default',
'path' => '',
'condition' => [],
],
[
'entity' => 'MailSettings',
'action' => 'delete',
'join' => '',
'target' => 'crm-popup',
'icon' => 'fa-trash',
'text' => E::ts('Delete'),
'style' => 'danger',
'path' => '',
'condition' => [
'is_default',
'=',
FALSE,
],
],
],
'type' => 'menu',
'alignment' => 'text-right',
],
],
'actions' => FALSE,
'classes' => [
'table',
'table-striped',
],
'addButton' => [
'path' => 'civicrm/admin/mailSettings/edit?action=add&reset=1',
'text' => E::ts('Add Mail Account'),
'icon' => 'fa-plus',
],
],
'acl_bypass' => FALSE,
],
'match' => [
'name',
'saved_search_id',
],
],
],
];

0 comments on commit 0e297e0

Please sign in to comment.