Index: admin/system_presets/simple/email_logs_email-log.php
===================================================================
--- admin/system_presets/simple/email_logs_email-log.php (revision 15165)
+++ admin/system_presets/simple/email_logs_email-log.php (working copy)
@@ -9,18 +9,18 @@
// section in debug mode
$debug_only_sections = Array (
- 'in-portal:searchlog',
+ 'in-portal:emaillog',
);
// toolbar buttons
$remove_buttons = Array (
// list of sent emails
-// 'email_log_list' => Array ('refresh', 'reset', 'view'),
+// 'email_log_list' => Array ('edit', 'refresh', 'reset', 'view'),
);
// fields to hide
$hidden_fields = Array (
- /*'EmailLogId', 'fromuser', 'addressto', 'subject', 'timestamp', 'event', 'EventParams'*/
+ /*'EmailLogId', 'From', 'To', 'OtherRecipients', 'Subject', 'HtmlBody', 'TextBody', 'SentOn', 'EventName', 'EventParams', 'AccessKey'*/
);
// virtual fields to hide
@@ -30,7 +30,7 @@
// fields to make required
$required_fields = Array (
- /*'EmailLogId', 'fromuser', 'addressto', 'subject', 'timestamp', 'event', 'EventParams'*/
+ /*'EmailLogId', 'From', 'To', 'OtherRecipients', 'Subject', 'HtmlBody', 'TextBody', 'SentOn', 'EventName', 'EventParams', 'AccessKey'*/
);
// virtual fields to make required
@@ -46,5 +46,5 @@
// hide columns in grids
$hide_columns = Array (
// currently not in user
-// 'Default' => Array ('EmailLogId', 'fromuser', 'addressto', 'subject', 'timestamp', 'event'),
+// 'Default' => Array ('EmailLogId', 'From', 'To', 'Subject', 'SentOn', 'EventName'),
);
\ No newline at end of file
Index: core/admin_templates/logs/email_logs/email_log_edit.tpl
===================================================================
--- core/admin_templates/logs/email_logs/email_log_edit.tpl (revision 0)
+++ core/admin_templates/logs/email_logs/email_log_edit.tpl (revision 0)
@@ -0,0 +1,102 @@
+<inp2:adm_SetPopupSize width="950" height="700"/>
+
+<inp2:m_include t="incs/header"/>
+<inp2:m_RenderElement name="combined_header" section="in-portal:emaillog" prefix="email-log" title_preset="email_log_edit"/>
+
+<!-- ToolBar -->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ a_toolbar = new ToolBar();
+
+ <inp2:m_RenderElement design="toolbar_button" icon="cancel" title="la_ToolTip_Close">
+ submit_event('email-log', 'OnGoBack');
+ </inp2:m_RenderElement>
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ <inp2:m_RenderElement design="toolbar_button" icon="prev" title="la_ToolTip_Prev">
+ go_to_id('email-log', '<inp2:email-log_PrevId/>');
+ </inp2:m_RenderElement>
+
+ <inp2:m_RenderElement design="toolbar_button" icon="next" title="la_ToolTip_Next">
+ go_to_id('email-log', '<inp2:email-log_NextId/>');
+ </inp2:m_RenderElement>
+
+ a_toolbar.Render();
+
+ <inp2:m_if check="email-log_IsSingle">
+ a_toolbar.HideButton('prev');
+ a_toolbar.HideButton('next');
+ a_toolbar.HideButton('sep1');
+ <inp2:m_else/>
+ <inp2:m_if check="email-log_IsLast">a_toolbar.DisableButton('next');</inp2:m_if>
+ <inp2:m_if check="email-log_IsFirst">a_toolbar.DisableButton('prev');</inp2:m_if>
+ </inp2:m_if>
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:email-log_SaveWarning name="grid_save_warning"/>
+<inp2:email-log_ErrorWarning name="form_error_warning"/>
+
+<div id="scroll_container">
+ <table class="edit-form">
+ <inp2:m_RenderElement name="inp_id_label" prefix="email-log" field="EmailLogId" title="la_fld_Id"/>
+
+ <inp2:m_if check="email-log_Field" name="EventName" db="db">
+ <inp2:m_RenderElement name="inp_label" prefix="email-log" field="EventName" title="la_fld_Event"/>
+ </inp2:m_if>
+
+ <inp2:m_RenderElement name="inp_label" prefix="email-log" field="From" title="la_fld_Sender"/>
+ <inp2:m_RenderElement name="inp_label" prefix="email-log" field="To" title="la_fld_Recipient"/>
+
+ <inp2:m_DefineElement name="recipient_element">
+ <inp2:m_Param name="recipient_name"/> <<inp2:m_Param name="recipient_email"/>>
+ <inp2:m_ifnot check="m_Param" name="is_last">; </inp2:m_ifnot>
+ </inp2:m_DefineElement>
+
+ <inp2:m_DefineElement name="recipient_type_element">
+ <strong><inp2:RecipientType/>:</strong> <inp2:RecipientsByType render_as="recipient_element" strip_nl="2"/>
+ </inp2:m_DefineElement>
+
+ <inp2:m_RenderElement design="form_row" prefix="email-log" field="OtherRecipients">
+ <td class="control-cell" valign="top">
+ <inp2:$prefix_PrintOtherRecipients render_as="recipient_type_element"/>
+ </td>
+ </inp2:m_RenderElement>
+
+ <inp2:m_RenderElement name="inp_label" prefix="email-log" field="Subject"/>
+
+ <inp2:m_RenderElement design="form_row" prefix="email-log" field="HtmlBody" title="la_fld_HtmlVersion">
+ <td class="control-cell" valign="top">
+ <iframe src="<inp2:m_Link {$prefix}_event='OnGetHtmlBody' pass='m,$prefix'/>" style="border: 1px solid black;" width="640" height="250" align="left">
+ You browser doesn't support frames!
+ </iframe>
+ </td>
+ </inp2:m_RenderElement>
+
+ <inp2:m_RenderElement design="form_row" prefix="email-log" field="TextBody" title="la_fld_TextVersion">
+ <td class="control-cell" valign="top">
+ <div style="border: 1px solid black; width: 624px; height: 234px; padding: 8px; font-family: serif; font-size: 16px;">
+ <inp2:$prefix_Field name="$field" nl2br="1"/>
+ </div>
+ </td>
+ </inp2:m_RenderElement>
+
+ <inp2:m_RenderElement name="inp_label" prefix="email-log" field="SentOn"/>
+
+ <!--##
+ <inp2:m_RenderElement name="inp_label" prefix="email-log" field="EventParams"/>
+ <inp2:m_RenderElement name="inp_label" prefix="email-log" field="AccessKey"/>
+ ##-->
+
+ <inp2:m_RenderElement name="inp_edit_filler"/>
+ </table>
+</div>
+
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: core\admin_templates\logs\email_logs\email_log_edit.tpl
___________________________________________________________________
Added: svn:eol-style
+ LF
Index: core/admin_templates/logs/email_logs/email_log_list.tpl
===================================================================
--- core/admin_templates/logs/email_logs/email_log_list.tpl (revision 15165)
+++ core/admin_templates/logs/email_logs/email_log_list.tpl (working copy)
@@ -14,9 +14,15 @@
function edit()
{
-
+ std_edit_temp_item('email-log', 'logs/email_logs/email_log_edit');
}
+ <inp2:m_RenderElement design="toolbar_button" icon="edit" title="la_ToolTip_ViewItem" short_title="la_ToolTip_ViewDetails">
+ edit();
+ </inp2:m_RenderElement>
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
a_toolbar.AddButton(
new ToolBarButton(
'refresh',
@@ -39,14 +45,12 @@
)
);
- a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+ <inp2:m_RenderElement design="toolbar_button" icon="view" title="la_ToolTip_View">
+ show_viewmenu(a_toolbar,'view');
+ </inp2:m_RenderElement>
- a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function(id) {
- show_viewmenu(a_toolbar,'view');
- }
- ) );
-
a_toolbar.Render();
</script>
</td>
@@ -61,4 +65,8 @@
<inp2:m_RenderElement name="grid" PrefixSpecial="email-log" IdField="EmailLogId" grid="Default"/>
+<script type="text/javascript">
+ Grids['email-log'].SetDependantToolbarButtons( new Array('edit') );
+</script>
+
<inp2:m_include t="incs/footer"/>
Index: core/install/english.lang
===================================================================
--- core/install/english.lang (revision 15225)
+++ core/install/english.lang (working copy)
@@ -1,7 +1,7 @@
<LANGUAGES Version="6">
<LANGUAGE Encoding="base64" PackName="English" LocalName="English" DateFormat="m/d/Y" TimeFormat="g:i A" InputDateFormat="m/d/Y" InputTimeFormat="g:i:s A" DecimalPoint="." ThousandSep="," Charset="utf-8" UnitSystem="2" Locale="en-US" UserDocsUrl="http://docs.in-portal.org/eng/index.php">
<EMAILDESIGNS>
- <HTML>JGJvZHkNCjxici8+PGJyLz4NCg0KU2luY2VyZWx5LDxici8+PGJyLz4NCg0KV2Vic2l0ZSBhZG1pbmlzdHJhdGlvbi4=</HTML>
+ <HTML>JGJvZHkNCjxici8+PGJyLz4NCg0KU2luY2VyZWx5LDxici8+PGJyLz4NCg0KV2Vic2l0ZSBhZG1pbmlzdHJhdGlvbi4NCg0KPCEtLSMjIDxpbnAyOmVtYWlsLWxvZ19JdGVtTGluayB0ZW1wbGF0ZT0icGxhdGZvcm0vbXlfYWNjb3VudC9lbWFpbCIvPiAjIy0tPg==</HTML>
</EMAILDESIGNS>
<PHRASES>
<PHRASE Label="la_Active" Module="Core" Type="1">QWN0aXZl</PHRASE>
@@ -161,6 +161,7 @@
<PHRASE Label="la_config_DefaultGridPerPage" Module="Core" Type="1">RGVmYXVsdCAiUGVyIFBhZ2UiIHNldHRpbmcgaW4gR3JpZHM=</PHRASE>
<PHRASE Label="la_config_DefaultRegistrationCountry" Module="Core" Type="1">RGVmYXVsdCBSZWdpc3RyYXRpb24gQ291bnRyeQ==</PHRASE>
<PHRASE Label="la_config_DefaultTrackingCode" Module="Core" Type="1">RGVmYXVsdCBBbmFseXRpY3MgVHJhY2tpbmcgQ29kZQ==</PHRASE>
+ <PHRASE Label="la_config_EmailLogRotationInterval" Module="Core" Type="1" Hint="RW1haWwgTG9nIHN0b3JlcyB0aGUgZXhhY3QgY29weSBvZiBhbGwgZW1haWxzIHRoYXQgYmVlbiBzZW50IG91dCBieSB5b3VyIHdlYnNpdGUuIFRoZSBmb2xsb3dpbmcgaW5mb3JtYXRpb24gaXMgc3RvcmVkOiBUaW1lLCBTZW5kZXIsIFJlY2lwaWVudCwgU3ViamVjdCBhbmQgRW1haWwgQm9keS4gVGhpcyBzZXR0aW5nIGFsbG93cyB5b3UgdG8gY29udHJvbCBmb3IgaG93IGxvbmcgdGhlc2UgZW1haWxzIHdpbGwgYmUgc3RvcmVkIGluIHRoZSBsb2cgYW5kIHRoZW4gYXV0b21hdGljYWxseSBkZWxldGVkLiBVc2Ugb3B0aW9uIE5ldmVyIHRvIGNvbXBsZXRlbHkgdHVybiBlbWFpbCBsb2dnaW5nIG9mZiwgYW5kIG9wdGlvbiBGb3JldmVyIHRvIGRpc2FibGUgYXV0b21hdGljIGxvZyBjbGVhbnVwLg==">S2VlcCBFbWFpbCBMb2cgZm9y</PHRASE>
<PHRASE Label="la_config_EnablePageContentRevisionControl" Module="Core" Type="1">RW5hYmxlIFJldmlzaW9uIENvbnRyb2wgZm9yIFNlY3Rpb24gQ29udGVudA==</PHRASE>
<PHRASE Label="la_config_error_template" Module="Core" Type="1">VGVtcGxhdGUgZm9yICJGaWxlIG5vdCBmb3VuZCAoNDA0KSIgRXJyb3I=</PHRASE>
<PHRASE Label="la_config_ExcludeTemplateSectionsFromSearch" Module="Core" Type="1">RXhjbHVkZSB0ZW1wbGF0ZSBiYXNlZCBTZWN0aW9ucyBmcm9tIFNlYXJjaCBSZXN1bHRzIChpZS4gVXNlciBSZWdpc3RyYXRpb24p</PHRASE>
@@ -536,6 +537,7 @@
<PHRASE Label="la_fld_Options" Module="Core" Type="1">T3B0aW9ucw==</PHRASE>
<PHRASE Label="la_fld_OptionTitle" Module="Core" Type="1">T3B0aW9uIFRpdGxl</PHRASE>
<PHRASE Label="la_fld_Order" Module="Core" Type="1" Column="T3JkZXI=">T3JkZXI=</PHRASE>
+ <PHRASE Label="la_fld_OtherRecipients" Module="Core" Type="1" Column="T3RoZXIgUmVjaXBpZW50cw==">T3RoZXIgUmVjaXBpZW50cw==</PHRASE>
<PHRASE Label="la_fld_OverridePageCacheKey" Module="Core" Type="1">T3ZlcndyaXRlIERlZmF1bHQgQ2FjaGluZyBLZXk=</PHRASE>
<PHRASE Label="la_fld_PackName" Module="Core" Type="1" Column="UGFjayBOYW1l">UGFjayBOYW1l</PHRASE>
<PHRASE Label="la_fld_PaddingBottom" Module="Core" Type="1">UGFkZGluZyBCb3R0b20=</PHRASE>
@@ -569,6 +571,7 @@
<PHRASE Label="la_fld_Protected" Module="Core" Type="1" Column="UHJvdGVjdGVk">UHJvdGVjdGVk</PHRASE>
<PHRASE Label="la_fld_Qty" Module="Core" Type="1" Column="UXR5">UXVhbnRpdHk=</PHRASE>
<PHRASE Label="la_fld_Rating" Module="Core" Type="1" Column="UmF0aW5n">UmF0aW5n</PHRASE>
+ <PHRASE Label="la_fld_Recipient" Module="Core" Type="1" Column="UmVjaXBpZW50">UmVjaXBpZW50</PHRASE>
<PHRASE Label="la_fld_RecipientAddress" Module="Core" Type="1">UmVjaXBpZW50J3MgQWRkcmVzcw==</PHRASE>
<PHRASE Label="la_fld_RecipientAddressType" Module="Core" Type="1">UmVjaXBpZW50J3MgQWRkcmVzcyBUeXBl</PHRASE>
<PHRASE Label="la_fld_RecipientName" Module="Core" Type="1">UmVjaXBpZW50J3MgTmFtZQ==</PHRASE>
@@ -602,6 +605,7 @@
<PHRASE Label="la_fld_SameAsThumb" Module="Core" Type="1">U2FtZSBBcyBUaHVtYg==</PHRASE>
<PHRASE Label="la_fld_ScheduleDate" Module="Core" Type="1">U2NoZWR1bGUgRGF0ZQ==</PHRASE>
<PHRASE Label="la_fld_SearchTerm" Module="Core" Type="1" Column="U2VhcmNoIFRlcm0=">U2VhcmNoIFRlcm0=</PHRASE>
+ <PHRASE Label="la_fld_Sender" Module="Core" Type="1" Column="U2VuZGVy">U2VuZGVy</PHRASE>
<PHRASE Label="la_fld_SenderAddress" Module="Core" Type="1">U2VuZGVyJ3MgQWRkcmVzcw==</PHRASE>
<PHRASE Label="la_fld_SenderName" Module="Core" Type="1">U2VuZGVyJ3MgTmFtZQ==</PHRASE>
<PHRASE Label="la_fld_SentOn" Module="Core" Type="1" Column="U2VudCBPbg==">U2VudCBPbg==</PHRASE>
@@ -783,6 +787,8 @@
<PHRASE Label="la_opt_Email" Module="Core" Type="1">RS1tYWls</PHRASE>
<PHRASE Label="la_opt_EmailBody" Module="Core" Type="1">RS1tYWlsIEJvZHk=</PHRASE>
<PHRASE Label="la_opt_EmailEvents" Module="Core" Type="1">RS1tYWlsIEV2ZW50cw==</PHRASE>
+ <PHRASE Label="la_opt_EmailLogKeepForever" Module="Core" Type="1">Rm9yZXZlciAobmV2ZXIgZGVsZXRlZCBhdXRvbWF0aWNhbGx5KQ==</PHRASE>
+ <PHRASE Label="la_opt_EmailLogKeepNever" Module="Core" Type="1">TmV2ZXIgKHR1cm5lZCBvZmYp</PHRASE>
<PHRASE Label="la_opt_EmailSubject" Module="Core" Type="1">RS1tYWlsIFN1YmplY3Q=</PHRASE>
<PHRASE Label="la_opt_Everyone" Module="Core" Type="1">RXZlcnlvbmU=</PHRASE>
<PHRASE Label="la_opt_Exact" Module="Core" Type="1">RXhhY3Q=</PHRASE>
@@ -809,6 +815,10 @@
<PHRASE Label="la_opt_NotLike" Module="Core" Type="1">Tm90IGxpa2U=</PHRASE>
<PHRASE Label="la_opt_NotProcessed" Module="Core" Type="1">Tm90IFByb2Nlc3NlZA==</PHRASE>
<PHRASE Label="la_opt_NotReplied" Module="Core" Type="1">Tm90IFJlcGxpZWQ=</PHRASE>
+ <PHRASE Label="la_opt_OneDay" Module="Core" Type="1">MSBkYXk=</PHRASE>
+ <PHRASE Label="la_opt_OneMonth" Module="Core" Type="1">MSBtb250aA==</PHRASE>
+ <PHRASE Label="la_opt_OneWeek" Module="Core" Type="1">MSB3ZWVr</PHRASE>
+ <PHRASE Label="la_opt_OneYear" Module="Core" Type="1">MSB5ZWFy</PHRASE>
<PHRASE Label="la_opt_PartiallyProcessed" Module="Core" Type="1">UGFydGlhbGx5IFByb2Nlc3NlZA==</PHRASE>
<PHRASE Label="la_opt_Pending" Module="Core" Type="1">UGVuZGluZw==</PHRASE>
<PHRASE Label="la_opt_Phone" Module="Core" Type="1">UGhvbmU=</PHRASE>
@@ -834,7 +844,9 @@
<PHRASE Label="la_opt_System" Module="Core" Type="1">U3lzdGVt</PHRASE>
<PHRASE Label="la_opt_Tab" Module="Core" Type="1">VGFi</PHRASE>
<PHRASE Label="la_opt_Template" Module="Core" Type="1">VGVtcGxhdGU=</PHRASE>
+ <PHRASE Label="la_opt_ThreeMonths" Module="Core" Type="1">MyBtb250aHM=</PHRASE>
<PHRASE Label="la_opt_Title" Module="Core" Type="1">VGl0bGU=</PHRASE>
+ <PHRASE Label="la_opt_TwoWeeks" Module="Core" Type="1">MiB3ZWVrcw==</PHRASE>
<PHRASE Label="la_opt_User" Module="Core" Type="1">VXNlcg==</PHRASE>
<PHRASE Label="la_opt_UserEmailActivation" Module="Core" Type="1">RW1haWwgQWN0aXZhdGlvbg==</PHRASE>
<PHRASE Label="la_opt_UserInstantRegistration" Module="Core" Type="1">SW1tZWRpYXRlIA==</PHRASE>
@@ -938,7 +950,6 @@
<PHRASE Label="la_prompt_FieldName" Module="Core" Type="1">RmllbGQgTmFtZQ==</PHRASE>
<PHRASE Label="la_prompt_FieldPrompt" Module="Core" Type="1">RmllbGQgUHJvbXB0</PHRASE>
<PHRASE Label="la_prompt_Frequency" Module="Core" Type="1">RnJlcXVlbmN5</PHRASE>
- <PHRASE Label="la_prompt_FromUsername" Module="Core" Type="1">RnJvbQ==</PHRASE>
<PHRASE Label="la_prompt_heading" Module="Core" Type="1">SGVhZGluZw==</PHRASE>
<PHRASE Label="la_prompt_HitLimits" Module="Core" Type="1">KE1pbmltdW0gNCk=</PHRASE>
<PHRASE Label="la_prompt_Import_Source" Module="Core" Type="1">SW1wb3J0IFNvdXJjZQ==</PHRASE>
@@ -1404,6 +1415,7 @@
<PHRASE Label="la_title_Thesaurus" Module="Core" Type="1">VGhlc2F1cnVz</PHRASE>
<PHRASE Label="la_title_UpdatingCategories" Module="Core" Type="1">VXBkYXRpbmcgU2VjdGlvbnM=</PHRASE>
<PHRASE Label="la_title_Users" Module="Core" Type="1">VXNlcnM=</PHRASE>
+ <PHRASE Label="la_title_ViewingEmailLog" Module="Core" Type="1">Vmlld2luZyBFbWFpbCBMb2c=</PHRASE>
<PHRASE Label="la_title_ViewingFormSubmission" Module="Core" Type="1">Vmlld2luZyBmb3JtIHN1Ym1pc3Npb24=</PHRASE>
<PHRASE Label="la_title_ViewingMailingList" Module="Core" Type="1">Vmlld2luZyBNYWlsaW5nIExpc3Q=</PHRASE>
<PHRASE Label="la_title_ViewingReply" Module="Core" Type="1">Vmlld2luZyBSZXBseQ==</PHRASE>
Index: core/install/install_data.sql
===================================================================
--- core/install/install_data.sql (revision 15165)
+++ core/install/install_data.sql (working copy)
@@ -89,6 +89,7 @@
INSERT INTO SystemSettings VALUES(DEFAULT, 'MailingListQueuePerStep', '10', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_MailingListQueuePerStep', 'text', NULL, NULL, 50.08, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'MailingListSendPerStep', '10', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_MailingListSendPerStep', 'text', NULL, NULL, 50.09, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'DefaultEmailRecipients', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_DefaultEmailRecipients', 'text', NULL, NULL, 50.10, 0, 0, NULL);
+INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_EmailLogRotationInterval', 'select', NULL, '=la_opt_EmailLogKeepNever||86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever', 50.11, 0, 0, 'hint:la_config_EmailLogRotationInterval');
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseOutputCompression', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseOutputCompression', 'checkbox', '', '', 60.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'OutputCompressionLevel', '7', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_OutputCompressionLevel', 'text', '', '', 60.02, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'UseTemplateCompression', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseTemplateCompression', 'checkbox', '', '', 60.03, 0, 1, NULL);
@@ -633,6 +634,7 @@
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:sessionlog.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:sessionlog.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:emaillog.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:emaillog.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:emaillog.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:visits.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:visits.delete', 11, 1, 1, 0);
Index: core/install/install_schema.sql
===================================================================
--- core/install/install_schema.sql (revision 15225)
+++ core/install/install_schema.sql (working copy)
@@ -389,14 +389,18 @@
CREATE TABLE EmailLog (
EmailLogId int(11) NOT NULL AUTO_INCREMENT,
- fromuser varchar(200) DEFAULT NULL,
- addressto varchar(255) DEFAULT NULL,
- `subject` varchar(255) DEFAULT NULL,
- `timestamp` bigint(20) DEFAULT '0',
- `event` varchar(100) DEFAULT NULL,
+ `From` varchar(255) NOT NULL DEFAULT '',
+ `To` varchar(255) NOT NULL DEFAULT '',
+ OtherRecipients text,
+ `Subject` varchar(255) NOT NULL DEFAULT '',
+ HtmlBody longtext,
+ TextBody longtext,
+ SentOn int(11) DEFAULT NULL,
+ EventName varchar(255) NOT NULL DEFAULT '',
EventParams text,
+ AccessKey varchar(32) NOT NULL DEFAULT '',
PRIMARY KEY (EmailLogId),
- KEY `timestamp` (`timestamp`)
+ KEY `timestamp` (SentOn)
);
CREATE TABLE SystemCache (
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql (revision 15225)
+++ core/install/upgrades.sql (working copy)
@@ -2663,3 +2663,23 @@
ALTER TABLE Languages
ADD HtmlEmailTemplate TEXT NULL,
ADD TextEmailTemplate TEXT NULL;
+
+ALTER TABLE EmailLog CHANGE fromuser `From` VARCHAR(255) NOT NULL DEFAULT '';
+ALTER TABLE EmailLog CHANGE addressto `To` VARCHAR(255) NOT NULL DEFAULT '';
+ALTER TABLE EmailLog CHANGE subject `Subject` VARCHAR(255) NOT NULL DEFAULT '';
+ALTER TABLE EmailLog CHANGE `timestamp` SentOn INT(11) NULL;
+ALTER TABLE EmailLog CHANGE `event` EventName VARCHAR(255) NOT NULL DEFAULT '';
+
+ALTER TABLE EmailLog ADD OtherRecipients TEXT NULL AFTER `To`;
+
+ALTER TABLE EmailLog
+ ADD HtmlBody LONGTEXT NULL AFTER `Subject`,
+ ADD TextBody LONGTEXT NULL AFTER HtmlBody;
+
+ALTER TABLE EmailLog ADD AccessKey VARCHAR(32) NOT NULL DEFAULT '';
+
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:emaillog.edit', 11, 1, 1, 0);
+
+DELETE FROM LanguageLabels WHERE PhraseKey = 'LA_PROMPT_FROMUSERNAME';
+
+INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailLogRotationInterval', '-1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_EmailLogRotationInterval', 'select', NULL, '=la_opt_EmailLogKeepNever||86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever', 50.11, 0, 0, 'hint:la_config_EmailLogRotationInterval');
Index: core/kernel/utility/email.php
===================================================================
--- core/kernel/utility/email.php (revision 15226)
+++ core/kernel/utility/email.php (working copy)
@@ -238,7 +238,22 @@
$this->sender->SetEncodedHeader($header_name, $header_value);
}
- // 2. set body
+ if ( $this->_storeEmailLog() ) {
+ // 2. prepare log
+ $log_fields_hash = Array (
+ 'From' => $this->fromName . ' (' . $this->fromEmail . ')',
+ 'To' => $this->toName . ' (' . $this->toEmail . ')',
+ 'OtherRecipients' => serialize($this->recipients),
+ 'Subject' => $message_subject,
+ 'SentOn' => TIMENOW,
+ 'EventName' => $this->emailEvent->GetDBField('Event'),
+ 'EventParams' => serialize($this->_getCustomParams()),
+ );
+
+ $this->params['email_access_key'] = $this->_generateAccessKey($log_fields_hash);
+ }
+
+ // 3. set body
$html_message_body = $this->_getMessageBody(true);
$plain_message_body = $this->_getMessageBody(false);
@@ -258,22 +273,48 @@
$this->_changeLanguage(true);
- // 3. set log
- $log_fields_hash = Array (
- 'fromuser' => $this->fromName . ' (' . $this->fromEmail . ')',
- 'addressto' => $this->toName . ' (' . $this->toEmail . ')',
- 'subject' => $message_subject,
- 'timestamp' => TIMENOW,
- 'event' => $this->emailEvent->GetDBField('Event'),
- 'EventParams' => serialize($this->_getCustomParams()),
- );
+ if ( $this->_storeEmailLog() ) {
+ // 4. set log
+ $log_fields_hash['HtmlBody'] = $html_message_body;
+ $log_fields_hash['TextBody'] = $plain_message_body;
+ $log_fields_hash['AccessKey'] = $this->params['email_access_key'];
+ $this->sender->setLogData($log_fields_hash);
+ }
- $this->sender->setLogData($log_fields_hash);
-
return $this->sender->Deliver(null, $immediate_send);
}
/**
+ * Determines whatever we should keep e-mail log or not
+ *
+ * @return bool
+ * @access protected
+ */
+ protected function _storeEmailLog()
+ {
+ return $this->Application->ConfigValue('EmailLogRotationInterval') != '';
+ }
+
+ /**
+ * Generates access key for accessing e-mail later
+ *
+ * @param Array $log_fields_hash
+ * @return string
+ * @access protected
+ */
+ protected function _generateAccessKey($log_fields_hash)
+ {
+ $ret = '';
+ $use_fields = Array ('From', 'To', 'Subject');
+
+ foreach ($use_fields as $use_field) {
+ $ret .= $log_fields_hash[$use_field] . ':';
+ }
+
+ return md5($ret . microtime(true));
+ }
+
+ /**
* Processes email sender
*
* @return void
@@ -373,25 +414,24 @@
);
$default_email = $this->Application->ConfigValue('DefaultEmailSender');
+ $this->recipients = array_map(Array ($this, '_transformRecipientsIntoPairs'), $this->recipients);
foreach ($this->recipients as $recipient_type => $recipients) {
// add recipients to email
- $pairs = $this->_transformRecipientsIntoPairs($recipients);
-
- if ( !$pairs ) {
+ if ( !$recipients ) {
continue;
}
if ( $recipient_type == EmailEvent::RECIPIENT_TYPE_TO ) {
- $this->toEmail = $pairs[0]['email'] ? $pairs[0]['email'] : $default_email;
- $this->toName = $pairs[0]['name'] ? $pairs[0]['name'] : $this->toEmail;
+ $this->toEmail = $recipients[0]['email'] ? $recipients[0]['email'] : $default_email;
+ $this->toName = $recipients[0]['name'] ? $recipients[0]['name'] : $this->toEmail;
}
$header_name = $header_mapping[$recipient_type];
- foreach ($pairs as $pair) {
- $email = $pair['email'] ? $pair['email'] : $default_email;
- $name = $pair['name'] ? $pair['name'] : $email;
+ foreach ($recipients as $recipient) {
+ $email = $recipient['email'] ? $recipient['email'] : $default_email;
+ $name = $recipient['name'] ? $recipient['name'] : $email;
$this->sender->AddRecipient($header_name, $email, $name);
}
@@ -683,6 +723,7 @@
* @param bool $is_html
* @return string
* @access protected
+ * @todo maybe ConvertToText will strip all <inp2: tags
*/
protected function _applyMessageDesign($text, $is_html = true)
{
@@ -712,6 +753,7 @@
* @param bool $is_html
* @return bool|string
* @access protected
+ * @todo maybe ConvertToText will strip all <inp2: tags
*/
protected function _getMessageBody($is_html = false)
{
Index: core/units/helpers/mailing_list_helper.php
===================================================================
--- core/units/helpers/mailing_list_helper.php (revision 15165)
+++ core/units/helpers/mailing_list_helper.php (working copy)
@@ -41,6 +41,10 @@
$esender->SetFrom($mailing_data['FromEmail'], $mailing_data['FromName']);
$esender->SetSubject($mailing_data['Subject']);
+ if ( !$mailing_data['MessageText'] ) {
+ $mailing_data['MessageText'] = $esender->ConvertToText($mailing_data['MessageHtml']);
+ }
+
$esender->SetBody($mailing_data['MessageHtml'], $mailing_data['MessageText']);
// 2. add attachment if any
@@ -56,16 +60,21 @@
// 3. set recipient specific fields
$esender->SetTo($email, $email);
- // 4. write to log
- $log_fields_hash = Array (
- 'fromuser' => $mailing_data['FromName'] . '<' . $mailing_data['FromEmail'] . '>',
- 'addressto' => $email,
- 'subject' => $mailing_data['Subject'],
- 'timestamp' => adodb_mktime(),
- 'EventParams' => serialize( Array ('MailingId' => $mailing_id) ),
- );
+ if ( $this->Application->ConfigValue('EmailLogRotationInterval') != '' ) {
+ // 4. write to log
+ $log_fields_hash = Array (
+ 'From' => $mailing_data['FromName'] . '(' . $mailing_data['FromEmail'] . ')',
+ 'To' => $email,
+ 'Subject' => $mailing_data['Subject'],
+ 'HtmlBody' => $mailing_data['MessageHtml'],
+ 'TextBody' => $mailing_data['MessageText'],
+ 'SentOn' => TIMENOW,
+ 'EventParams' => serialize( Array ('MailingId' => $mailing_id) ),
+ );
- $esender->setLogData($log_fields_hash);
+ $esender->setLogData($log_fields_hash);
+ }
+
$esender->Deliver(null, $mailing_id, false);
}
Index: core/units/logs/email_logs/email_log_eh.php
===================================================================
--- core/units/logs/email_logs/email_log_eh.php (revision 0)
+++ core/units/logs/email_logs/email_log_eh.php (revision 0)
@@ -0,0 +1,126 @@
+<?php
+/**
+ * @version $Id$
+ * @package In-Portal
+ * @copyright Copyright (C) 1997 - 2012 Intechnic. All rights reserved.
+ * @license GNU/GPL
+ * In-Portal is Open Source software.
+ * This means that this software may have been modified pursuant
+ * the GNU General Public License, and as distributed it includes
+ * or is derivative of works licensed under the GNU General Public License
+ * or other free or open source software licenses.
+ * See http://www.in-portal.org/license for copyright notices and details.
+ */
+
+defined('FULL_PATH') or die('restricted access!');
+
+class EmailLogEventHandler extends kDBEventHandler {
+
+ /**
+ * Allows to override standard permission mapping
+ *
+ * @return void
+ * @access protected
+ * @see kEventHandler::$permMapping
+ */
+ protected function mapPermissions()
+ {
+ parent::mapPermissions();
+
+ $permissions = Array (
+ 'OnItemBuild' => Array ('self' => true),
+ 'OnGetHtmlBody' => Array ('self' => 'edit'),
+ );
+
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Returns ID of current item to be edited
+ * by checking ID passed in get/post as prefix_id
+ * or by looking at first from selected ids, stored.
+ * Returned id is also stored in Session in case
+ * it was explicitly passed as get/post
+ *
+ * @param kEvent $event
+ * @return int
+ * @access public
+ */
+ public function getPassedID(kEvent $event)
+ {
+ if ( $this->Application->isAdmin ) {
+ return parent::getPassedID($event);
+ }
+
+ $authkey = $this->Application->GetVar('authkey');
+
+ return $authkey ? Array ('AccessKey' => $authkey) : false;
+ }
+
+ /**
+ * [SCHEDULED TASK] Will remove old e-mail logs
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnRotate(kEvent $event)
+ {
+ $rotation_interval = $this->Application->ConfigValue('EmailLogRotationInterval');
+
+ if ( $rotation_interval == '' || $rotation_interval == -1 ) {
+ // never OR forever
+ return;
+ }
+
+ $sql = 'SELECT ' . $this->Application->getUnitOption($event->Prefix, 'IDField') . '
+ FROM ' . $this->Application->getUnitOption($event->Prefix, 'TableName') . '
+ WHERE ' . TIMENOW . ' - SentOn > ' . $rotation_interval;
+ $ids = $this->Conn->GetCol($sql);
+
+ if ( $ids ) {
+ $temp_handler = $this->Application->recallObject($event->getPrefixSpecial() . '_TempHandler', 'kTempTablesHandler', Array ('parent_event' => $event));
+ /* @var $temp_handler kTempTablesHandler */
+
+ $temp_handler->DeleteItems($event->Prefix, $event->Special, $ids);
+ }
+ }
+
+ /**
+ * Returns HTML of sent e-mail for iframe
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnGetHtmlBody(kEvent $event)
+ {
+ $event->status = kEvent::erSTOP;
+
+ $object = $event->getObject();
+ /* @var $object kDBItem */
+
+ echo $object->GetDBField('HtmlBody');
+ }
+
+ /**
+ * Checks, that currently loaded item is allowed for viewing (non permission-based)
+ *
+ * @param kEvent $event
+ * @return bool
+ * @access protected
+ */
+ protected function checkItemStatus(kEvent $event)
+ {
+ $object = $event->getObject();
+ /* @var $object kDBItem */
+
+ if ( !$object->isLoaded() ) {
+ return true;
+ }
+
+ $access_key = $object->GetDBField('AccessKey');
+
+ return $access_key && $this->Application->GetVar('authkey') == $access_key;
+ }
+}
\ No newline at end of file
Property changes on: core\units\logs\email_logs\email_log_eh.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ LF
Index: core/units/logs/email_logs/email_log_tp.php
===================================================================
--- core/units/logs/email_logs/email_log_tp.php (revision 0)
+++ core/units/logs/email_logs/email_log_tp.php (revision 0)
@@ -0,0 +1,131 @@
+<?php
+/**
+ * @version $Id$
+ * @package In-Portal
+ * @copyright Copyright (C) 1997 - 2012 Intechnic. All rights reserved.
+ * @license GNU/GPL
+ * In-Portal is Open Source software.
+ * This means that this software may have been modified pursuant
+ * the GNU General Public License, and as distributed it includes
+ * or is derivative of works licensed under the GNU General Public License
+ * or other free or open source software licenses.
+ * See http://www.in-portal.org/license for copyright notices and details.
+ */
+
+defined('FULL_PATH') or die('restricted access!');
+
+class EmailLogTagProcessor extends kDBTagProcessor {
+
+ /**
+ * Prints other e-mail recipients
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function PrintOtherRecipients($params)
+ {
+ $object = $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $other_recipients = $object->GetDBField('OtherRecipients');
+ $other_recipients = $other_recipients ? unserialize($other_recipients) : Array ();
+
+ $ret = '';
+ $block_params = $this->prepareTagParams($params);
+ $block_params['name'] = $params['render_as'];
+
+ foreach ($other_recipients as $recipient_type => $recipients) {
+ if ( $recipient_type == EmailEvent::RECIPIENT_TYPE_TO ) {
+ array_shift($recipients);
+ }
+
+ if ( $recipients ) {
+ $block_params['recipient_type'] = $recipient_type;
+ $block_params['recipients'] = $recipients;
+
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Returns recipient type
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function RecipientType($params)
+ {
+ $heading_mapping = Array (
+ EmailEvent::RECIPIENT_TYPE_TO => 'To',
+ EmailEvent::RECIPIENT_TYPE_CC => 'Cc',
+ EmailEvent::RECIPIENT_TYPE_BCC => 'Bcc',
+ );
+
+ $recipient_type = $this->Application->Parser->GetParam('recipient_type');
+
+ return $heading_mapping[$recipient_type];
+ }
+
+ /**
+ * Prints recipients
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function RecipientsByType($params)
+ {
+ $recipients = $this->Application->Parser->GetParam('recipients');
+ /* @var $recipients Array */
+
+ $ret = '';
+ $block_params = $this->prepareTagParams($params);
+ $block_params['name'] = $params['render_as'];
+
+ $recipient_count = count($recipients);
+
+ foreach ($recipients as $index => $recipient) {
+ $block_params['recipient_name'] = $recipient['name'] ? $recipient['name'] : $recipient['email'];
+ $block_params['recipient_email'] = $recipient['email'];
+ $block_params['is_last'] = $index == $recipient_count - 1;
+
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Creates link to an item including only it's id
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function ItemLink($params)
+ {
+ $access_key = $this->Application->Parser->GetParam('email_access_key');
+
+ if ( !$access_key ) {
+ return parent::ItemLink($params);
+ }
+
+ $params['authkey'] = $access_key;
+
+ if ( $this->Application->isAdmin ) {
+// $params['index_file'] = 'index.php';
+ $params['prefix'] = '_FRONT_END_';
+
+ if ( $this->Application->ConfigValue('UseModRewrite') ) {
+ $params['__MOD_REWRITE__'] = 1;
+ }
+ }
+
+ return $this->Application->ProcessParsedTag('m', 't', $params);
+ }
+}
\ No newline at end of file
Property changes on: core\units\logs\email_logs\email_log_tp.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ LF
Index: core/units/logs/email_logs/email_logs_config.php
===================================================================
--- core/units/logs/email_logs/email_logs_config.php (revision 15165)
+++ core/units/logs/email_logs/email_logs_config.php (working copy)
@@ -18,8 +18,8 @@
'Prefix' => 'email-log',
'ItemClass' => Array('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
- 'EventHandlerClass' => Array ('class' => 'kDBEventHandler', 'file' => '', 'build_event' => 'OnBuild'),
- 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'),
+ 'EventHandlerClass' => Array ('class' => 'EmailLogEventHandler', 'file' => 'email_log_eh.php', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array ('class' => 'EmailLogTagProcessor', 'file' => 'email_log_tp.php', 'build_event' => 'OnBuild'),
'AutoLoad' => true,
@@ -31,12 +31,22 @@
5 => 'mode',
),
+ 'ScheduledTasks' => Array(
+ 'rotate_email_logs' => Array('EventName' => 'OnRotate', 'RunInterval' => 86400),
+ ),
+
'IDField' => 'EmailLogId',
'TableName' => TABLE_PREFIX . 'EmailLog',
+ 'TitleField' => 'EmailLogId',
+
'TitlePresets' => Array (
- 'email_log_list' => Array ('prefixes' => Array('email-log_List'), 'format' => '!la_tab_EmailLog!',),
+ 'email_log_list' => Array ('prefixes' => Array('email-log_List'), 'format' => '!la_tab_EmailLog!'),
+
+ 'email_log_edit' => Array (
+ 'prefixes' => Array ('email-log'), 'format' => "!la_title_ViewingEmailLog! '#email-log_titlefield#'",
+ ),
),
'PermSection' => Array ('main' => 'in-portal:emaillog'),
@@ -47,7 +57,7 @@
'icon' => 'email_log',
'label' => 'la_tab_EmailLog',
'url' => Array('t' => 'logs/email_logs/email_log_list', 'pass' => 'm'),
- 'permissions' => Array ('view', 'delete'),
+ 'permissions' => Array ('view', 'edit', 'delete'),
'priority' => 5,
'type' => stTREE,
),
@@ -59,31 +69,34 @@
'ListSortings' => Array (
'' => Array (
- 'Sorting' => Array ('timestamp' => 'desc'),
+ 'Sorting' => Array ('SentOn' => 'desc'),
)
),
'Fields' => Array (
'EmailLogId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
- 'fromuser' => Array ('type' => 'string', 'max_len' => 200, 'default' => NULL),
- 'addressto' => Array ('type' => 'string', 'max_len' => 255, 'default' => NULL),
- 'subject' => Array ('type' => 'string', 'max_len' => 255, 'default' => NULL),
- 'timestamp' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
- 'event' => Array ('type' => 'string', 'max_len' => 100, 'default' => NULL),
+ 'From' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
+ 'To' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
+ 'OtherRecipients' => Array ('type' => 'string', 'default' => NULL),
+ 'Subject' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
+ 'HtmlBody' => Array ('type' => 'string', 'default' => NULL),
+ 'TextBody' => Array ('type' => 'string', 'default' => NULL),
+ 'SentOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
+ 'EventName' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'EventParams' => Array ('type' => 'string', 'default' => NULL),
+ 'AccessKey' => Array ('type' => 'string', 'max_len' => 20, 'not_null' => 1, 'default' => ''),
),
'Grids' => Array (
'Default' => Array (
- 'Icons' => Array ('default' => 'icon16_item.png'),
'Fields' => Array (
- 'EmailLogId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 50, ),
- 'fromuser' => Array ('title' => 'la_prompt_FromUsername', 'filter_block' => 'grid_like_filter', 'width' => 200, ),
- 'addressto' => Array ('title' => 'la_prompt_AddressTo', 'filter_block' => 'grid_like_filter', 'width' => 200, ),
- 'subject' => Array ('filter_block' => 'grid_like_filter', 'width' => 200, ),
- 'event' => Array ('filter_block' => 'grid_like_filter', 'width' => 170, ),
- 'timestamp' => Array ('title' => 'la_prompt_SentOn', 'filter_block' => 'grid_date_range_filter', 'width' => 145, ),
-// 'EventParams' => Array ('title' => 'la_col_EventParams', 'filter_block' => 'grid_like_filter', ),
+ 'EmailLogId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 80),
+ 'From' => Array ('title' => 'column:la_fld_Sender', 'filter_block' => 'grid_like_filter', 'width' => 200),
+ 'To' => Array ('title' => 'column:la_fld_Recipient', 'filter_block' => 'grid_like_filter', 'width' => 200),
+ 'Subject' => Array ('filter_block' => 'grid_like_filter', 'width' => 200),
+ 'EventName' => Array ('title' => 'column:la_fld_Event', 'filter_block' => 'grid_like_filter', 'width' => 170),
+ 'SentOn' => Array ('title' => 'la_prompt_SentOn', 'filter_block' => 'grid_date_range_filter', 'width' => 145),
+// 'EventParams' => Array ('title' => 'la_col_EventParams', 'filter_block' => 'grid_like_filter'),
),
),
),
Index: core/units/mailing_lists/mailing_list_eh.php
===================================================================
--- core/units/mailing_lists/mailing_list_eh.php (revision 15165)
+++ core/units/mailing_lists/mailing_list_eh.php (working copy)
@@ -61,9 +61,25 @@
$object->SetDBField('To', $to);
}
+
+ $this->setRequired($event);
}
/**
+ * Prepare recipient list
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnPreCreate(kEvent $event)
+ {
+ parent::OnPreCreate($event);
+
+ $this->setRequired($event);
+ }
+
+ /**
* Don't allow to delete mailings in progress
*
* @param kEvent $event
@@ -164,17 +180,45 @@
$object->SetDBField('To', implode(';', $recipients));
}
- if ( !$object->GetDBField('MessageText') ) {
- $object->setRequired('MessageHtml');
- }
-
// remember user, who created mailing, because of his name
// is needed for "From" field, but mailing occurs from cron
$user_id = $this->Application->RecallVar('user_id');
$object->SetDBField('PortalUserId', $user_id);
+
+ $this->setRequired($event);
}
/**
+ * Checks, that at least one message text field is filled
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnBeforeItemUpdate(kEvent $event)
+ {
+ parent::OnBeforeItemUpdate($event);
+
+ $this->setRequired($event);
+ }
+
+ /**
+ * Dynamically changes required fields
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function setRequired(kEvent $event)
+ {
+ $object = $event->getObject();
+ /* @var $object kDBItem */
+
+ $object->setRequired('MessageHtml', !$object->GetDBField('MessageText'));
+ $object->setRequired('MessageText', !$object->GetDBField('MessageHtml'));
+ }
+
+ /**
* Deletes mailing list email queue, when it becomes cancelled
*
* @param kEvent $event