Skip to content

Commit

Permalink
10.5: [Mail/Logs/Profiles] Added default widgets on the profile pages…
Browse files Browse the repository at this point in the history
… for 'Email Inbound Log' and 'Email Delivery Log'.
  • Loading branch information
jstanden committed Oct 4, 2024
1 parent f1495ac commit b93a643
Showing 1 changed file with 134 additions and 0 deletions.
134 changes: 134 additions & 0 deletions features/cerberusweb.core/patches/10.x/10.5.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,73 @@
$db->qstr('content'),
$db->qstr('hidden@bool: {{not worker_is_superuser}}')
));


// Default profile page

$db->ExecuteMaster(sprintf("INSERT INTO profile_tab (name, context, extension_id, updated_at, extension_params_json, pos) ".
"VALUES (%s, %s, %s, %d, %s, %d)",
$db->qstr('Overview'),
$db->qstr('cerb.contexts.mail.delivery.log'),
$db->qstr('cerb.profile.tab.dashboard'),
time(),
$db->qstr(json_encode([
"layout" => "sidebar_left",
])),
1
));

$new_profile_tab_id = $db->LastInsertId();

$db->ExecuteMaster(sprintf("INSERT INTO profile_widget (name, profile_tab_id, extension_id, extension_params_json, updated_at, pos, width_units, zone, options_kata) ".
"VALUES (%s, %d, %s, %s, %d, %d, %d, %s, %s)",
$db->qstr('Email Delivery Log'),
$new_profile_tab_id,
$db->qstr('cerb.profile.tab.widget.fields'),
$db->qstr(json_encode([
"context" => "cerb.contexts.mail.delivery.log",
"context_id" => "{{record_id}}",
"properties" => [
[
"created",
"from_id",
"mail_transport_id",
"subject",
"id",
"header_message_id",
"status_id",
"status_message",
"to",
"type"
]
],
"toolbar_kata" => "",
])),
time(),
1,
4,
$db->qstr('sidebar'),
$db->qstr('')
));

$db->ExecuteMaster(sprintf("INSERT INTO profile_widget (name, profile_tab_id, extension_id, extension_params_json, updated_at, pos, width_units, zone, options_kata) ".
"VALUES (%s, %d, %s, %s, %d, %d, %d, %s, %s)",
$db->qstr('Raw Message'),
$new_profile_tab_id,
$db->qstr('cerb.profile.tab.widget.sheet'),
$db->qstr(json_encode([
"data_query" => "type:worklist.records\r\nof:mail_delivery_log\r\nexpand:[properties]\r\nquery:(\r\n limit:1\r\n id:{{record_id}}\r\n sort:[id]\r\n)\r\nformat:dictionaries",
"cache_secs" => "",
"placeholder_simulator_kata" => "",
"sheet_kata" => "layout:\r\n style: fieldsets\r\n headings@bool: no\r\n paging@bool: no\r\n\r\ncolumns:\r\n markdown/properties:\r\n label: Properties\r\n params:\r\n value_template@raw:\r\n ```\r\n {{properties|kata_encode|raw}}\r\n ```\r\n ",
"toolbar_kata" => ""
])),
time(),
1,
4,
$db->qstr('content'),
$db->qstr('')
));
}

// ===========================================================================
Expand Down Expand Up @@ -661,6 +728,73 @@
$db->qstr('content'),
$db->qstr('')
));

// Default profile page

$db->ExecuteMaster(sprintf("INSERT INTO profile_tab (name, context, extension_id, updated_at, extension_params_json, pos) ".
"VALUES (%s, %s, %s, %d, %s, %d)",
$db->qstr('Overview'),
$db->qstr('cerb.contexts.mail.inbound.log'),
$db->qstr('cerb.profile.tab.dashboard'),
time(),
$db->qstr(json_encode([
"layout" => "sidebar_left",
])),
1
));

$new_profile_tab_id = $db->LastInsertId();

$db->ExecuteMaster(sprintf("INSERT INTO profile_widget (name, profile_tab_id, extension_id, extension_params_json, updated_at, pos, width_units, zone, options_kata) ".
"VALUES (%s, %d, %s, %s, %d, %d, %d, %s, %s)",
$db->qstr('Email Inbound Log'),
$new_profile_tab_id,
$db->qstr('cerb.profile.tab.widget.fields'),
$db->qstr(json_encode([
"context" => "cerb.contexts.mail.inbound.log",
"context_id" => "{{record_id}}",
"properties" => [
[
"id",
"from_id",
"status_id",
"status_message",
"created",
"header_message_id",
"mailbox_id",
"message_id",
"parse_time_ms",
"ticket_id",
"to"
]
],
"toolbar_kata" => "",
])),
time(),
1,
4,
$db->qstr('sidebar'),
$db->qstr('')
));

$db->ExecuteMaster(sprintf("INSERT INTO profile_widget (name, profile_tab_id, extension_id, extension_params_json, updated_at, pos, width_units, zone, options_kata) ".
"VALUES (%s, %d, %s, %s, %d, %d, %d, %s, %s)",
$db->qstr('Events Log'),
$new_profile_tab_id,
$db->qstr('cerb.profile.tab.widget.sheet'),
$db->qstr(json_encode([
"data_query" => "type:worklist.records\r\nof:mail_inbound_log\r\nexpand:[events_log]\r\nquery:(\r\n limit:1\r\n id:{{record_id}}\r\n sort:[id]\r\n)\r\nformat:dictionaries",
"cache_secs" => "",
"placeholder_simulator_kata" => "",
"sheet_kata" => "layout:\r\n style: fieldsets\r\n headings@bool: no\r\n paging@bool: no\r\n\r\ncolumns:\r\n markdown/properties:\r\n label: Events Log\r\n params:\r\n value_template@raw:\r\n ```\r\n {{events_log|kata_encode|raw}}\r\n ```\r\n ",
"toolbar_kata" => ""
])),
time(),
1,
4,
$db->qstr('content'),
$db->qstr('')
));
}

// ===========================================================================
Expand Down

0 comments on commit b93a643

Please sign in to comment.