Attached Files |
system_event_subscriptions_admin_list.patch [^] (47,182 bytes) 2012-04-04 08:54
[Show Content]
Index: admin/system_presets/simple/system_event_subscriptions_system-event-subscription.php
===================================================================
--- admin/system_presets/simple/system_event_subscriptions_system-event-subscription.php (revision 0)
+++ admin/system_presets/simple/system_event_subscriptions_system-event-subscription.php (revision 0)
@@ -0,0 +1,52 @@
+<?php
+
+ defined('FULL_PATH') or die('restricted access!');
+
+ // section removal
+ $remove_sections = Array (
+// 'in-portal:system_event_subscriptions'
+ );
+
+ // sections shown with debug on
+ $debug_only_sections = Array (
+ 'in-portal:system_event_subscriptions'
+ );
+
+ // toolbar buttons
+ $remove_buttons = Array (
+// list of stop words; section: Stop Words
+// 'system_event_subscription_list' => Array ('new_item', 'edit', 'delete', 'view', 'dbl-click'),
+
+// General" tab during adding/editing
+// 'system_event_subscription_edit' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'),
+ );
+
+ // fields to hide
+ $hidden_fields = Array (
+ /*'SubscriptionId', 'EmailEventId', 'SubscriberEmail', 'UserId', 'CategoryId',
+ 'ItemId', 'ParentItemId', 'SubscribedOn',*/
+ );
+
+ // virtual fields to hide
+ $virtual_hidden_fields = Array (
+ /*'Username', 'EmailEventName', 'CategoryName',*/
+ );
+
+ // fields to make required
+ $required_fields = Array (
+ /*'SubscriptionId',*/ 'EmailEventId', /*'SubscriberEmail', 'UserId', 'CategoryId',
+ 'ItemId', 'ParentItemId',*/ 'SubscribedOn',
+ );
+
+ // virtual fields to make required
+ $virtual_required_fields = Array (
+ /*'Username', 'EmailEventName', 'CategoryName',*/
+ );
+
+ // hide columns in grids
+ $hide_columns = Array (
+ /*'Default' => Array (
+ 'SubscriptionId', 'EmailEventId', 'EmailEventName', 'SubscriberEmail', 'UserId', 'Username', 'CategoryId',
+ 'CategoryName', 'ItemId', 'ItemName', 'ParentItemId', 'ParentItemName', 'SubscribedOn',
+ ),*/
+ );
\ No newline at end of file
Property changes on: admin\system_presets\simple\system_event_subscriptions_system-event-subscription.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ LF
Property changes on: core\admin_templates\system_event_subscriptions
___________________________________________________________________
Added: tsvn:autoprops
+ *.php = svn:eol-style=LF;svn:keywords=Id
*.tpl = svn:eol-style=LF
*.sql = svn:eol-style=LF
*.lang = svn:eol-style=LF
*.sh = svn:eol-style=LF;svn:executable
*.txt = svn:eol-style=LF
*.html = svn:eol-style=LF
*.htm = svn:eol-style=LF
*.css = svn:eol-style=LF
*.js = svn:eol-style=LF
*.xml = svn:eol-style=LF
.htaccess = svn:eol-style=LF
.smsignore = svn:eol-style=LF
COPYRIGHT = svn:eol-style=LF
CREDITS = svn:eol-style=LF
INSTALL = svn:eol-style=LF
LICENSE = svn:eol-style=LF
LICENSES = svn:eol-style=LF
README = svn:eol-style=LF
Added: bugtraq:url
+ http://tracker.in-portal.org/view.php?id=%BUGID%
Added: bugtraq:number
+ true
Added: bugtraq:logregex
+ (?:[Bb]ugs?|[Ii]ssues?|[Rr]eports?|[Ff]ixe?s?|[Rr]esolves?)+\s+(?:#?(?:\d+)[,\.\s]*)+
(\d+)
Index: core/admin_templates/system_event_subscriptions/system_event_subscription_edit.tpl
===================================================================
--- core/admin_templates/system_event_subscriptions/system_event_subscription_edit.tpl (revision 0)
+++ core/admin_templates/system_event_subscriptions/system_event_subscription_edit.tpl (revision 0)
@@ -0,0 +1,76 @@
+<inp2:adm_SetPopupSize width="550" height="400"/>
+
+<inp2:m_include t="incs/header"/>
+<inp2:m_RenderElement name="combined_header" section="in-portal:system_event_subscriptions" prefix="system-event-subscription" title_preset="system_event_subscription_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();
+ a_toolbar.AddButton( new ToolBarButton('select', '<inp2:m_phrase label="la_ToolTip_Save" escape="1"/>', function() {
+ submit_event('system-event-subscription', '<inp2:system-event-subscription_SaveEvent/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('cancel', '<inp2:m_phrase label="la_ToolTip_Cancel" escape="1"/>', function() {
+ cancel_edit('system-event-subscription', 'OnCancelEdit','<inp2:system-event-subscription_SaveEvent/>','<inp2:m_Phrase label="la_FormCancelConfirmation" escape="1"/>');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('reset_edit', '<inp2:m_phrase label="la_ToolTip_Reset" escape="1"/>', function() {
+ reset_form('system-event-subscription', 'OnReset', '<inp2:m_Phrase label="la_FormResetConfirmation" escape="1"/>');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('prev', '<inp2:m_phrase label="la_ToolTip_Prev" escape="1"/>', function() {
+ go_to_id('system-event-subscription', '<inp2:system-event-subscription_PrevId/>');
+ }
+ ) );
+ a_toolbar.AddButton( new ToolBarButton('next', '<inp2:m_phrase label="la_ToolTip_Next" escape="1"/>', function() {
+ go_to_id('system-event-subscription', '<inp2:system-event-subscription_NextId/>');
+ }
+ ) );
+
+ a_toolbar.Render();
+
+ <inp2:m_if check="system-event-subscription_IsSingle" >
+ a_toolbar.HideButton('prev');
+ a_toolbar.HideButton('next');
+ a_toolbar.HideButton('sep1');
+ <inp2:m_else/>
+ <inp2:m_if check="system-event-subscription_IsLast" >
+ a_toolbar.DisableButton('next');
+ </inp2:m_if>
+ <inp2:m_if check="system-event-subscription_IsFirst" >
+ a_toolbar.DisableButton('prev');
+ </inp2:m_if>
+ </inp2:m_if>
+ </script>
+ </td>
+ </tr>
+</tbody>
+</table>
+
+<inp2:system-event-subscription_SaveWarning name="grid_save_warning"/>
+<inp2:system-event-subscription_ErrorWarning name="form_error_warning"/>
+
+<div id="scroll_container">
+ <table class="edit-form">
+ <inp2:m_RenderElement name="inp_id_label" prefix="system-event-subscription" field="SubscriptionId" title="la_fld_Id"/>
+ <inp2:m_RenderElement name="inp_edit_options" prefix="system-event-subscription" field="EmailEventId" title="la_fld_SystemEvent" has_empty="1"/>
+ <inp2:m_RenderElement name="inp_label" prefix="system-event-subscription" field="EmailEventName" title="la_fld_EmailEvent"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="system-event-subscription" field="SubscriberEmail" title="la_fld_Email"/>
+ <inp2:m_RenderElement name="inp_edit_user" prefix="system-event-subscription" field="UserId" title="la_fld_Username"/>
+ <inp2:m_RenderElement name="inp_edit_category" prefix="system-event-subscription" field="CategoryId" title="la_fld_Category"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="system-event-subscription" field="ItemId" style="width: 50px;"/>
+ <inp2:m_RenderElement name="inp_edit_box" prefix="system-event-subscription" field="ParentItemId" style="width: 50px;"/>
+ <inp2:m_RenderElement name="inp_label" prefix="system-event-subscription" field="SubscribedOn"/>
+ <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\system_event_subscriptions\system_event_subscription_edit.tpl
___________________________________________________________________
Added: svn:eol-style
+ LF
Index: core/admin_templates/system_event_subscriptions/system_event_subscription_list.tpl
===================================================================
--- core/admin_templates/system_event_subscriptions/system_event_subscription_list.tpl (revision 0)
+++ core/admin_templates/system_event_subscriptions/system_event_subscription_list.tpl (revision 0)
@@ -0,0 +1,63 @@
+<inp2:m_include t="incs/header"/>
+<inp2:m_RenderElement name="combined_header" section="in-portal:system_event_subscriptions" prefix="system-event-subscription" title_preset="system_event_subscription_list" pagination="1"/>
+
+<!-- ToolBar -->
+<table class="toolbar" height="30" cellspacing="0" cellpadding="0" width="100%" border="0">
+<tbody>
+ <tr>
+ <td>
+ <script type="text/javascript">
+ //do not rename - this function is used in default grid for double click!
+ function edit()
+ {
+ std_edit_item('system-event-subscription', 'system_event_subscriptions/system_event_subscription_edit');
+ }
+
+ var a_toolbar = new ToolBar();
+ a_toolbar.AddButton( new ToolBarButton('new_item', '<inp2:m_phrase label="la_ToolTip_NewSystemEventSubscription" escape="1"/>::<inp2:m_phrase label="la_ToolTip_Add" escape="1"/>',
+ function() {
+ std_precreate_item('system-event-subscription', 'system_event_subscriptions/system_event_subscription_edit');
+ } ) );
+
+ a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>::<inp2:m_phrase label="la_ShortToolTip_Edit" escape="1"/>', edit) );
+ a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
+ function() {
+ std_delete_items('system-event-subscription')
+ } ) );
+
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+
+ a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
+ show_viewmenu(a_toolbar,'view');
+ }
+ ) );
+
+ a_toolbar.Render();
+ </script>
+ </td>
+ <inp2:m_RenderElement name="search_main_toolbar" prefix="system-event-subscription" grid="Default"/>
+ </tr>
+</tbody>
+</table>
+
+<inp2:m_DefineElement name="category_caption">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+ <inp2:m_param name="cat_name"/>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="grid_category_td">
+ <inp2:CategoryPath separator=" > " render_as="category_caption" />
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="grid_item_name_td">
+ <inp2:ItemName field="$associated_field"/>
+</inp2:m_DefineElement>
+
+<inp2:m_RenderElement name="grid" PrefixSpecial="system-event-subscription" IdField="SubscriptionId" grid="Default"/>
+<script type="text/javascript">
+ Grids['system-event-subscription'].SetDependantToolbarButtons( new Array('edit','delete') );
+</script>
+<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Property changes on: core\admin_templates\system_event_subscriptions\system_event_subscription_list.tpl
___________________________________________________________________
Added: svn:eol-style
+ LF
Index: core/install/english.lang
===================================================================
--- core/install/english.lang (revision 15257)
+++ core/install/english.lang (working copy)
@@ -336,7 +336,7 @@
<PHRASE Label="la_fld_BackgroundPosition" Module="Core" Type="1">QmFja2dyb3VuZCBQb3NpdGlvbg==</PHRASE>
<PHRASE Label="la_fld_BackgroundRepeat" Module="Core" Type="1">QmFja2dyb3VuZCBSZXBlYXQ=</PHRASE>
<PHRASE Label="la_fld_Bcc" Module="Core" Type="1" Column="QmNj">QmNj</PHRASE>
- <PHRASE Label="la_fld_BindToSystemEvent" Module="Core" Type="1" Hint="U3lzdGVtIEV2ZW50IGluICJwcmVmaXhbLnNwZWNpYWxdOk9uRXZlbnROYW1lIiBmb3JtYXQ=">QmluZCB0byBTeXN0ZW0gRXZlbnQ=</PHRASE>
+ <PHRASE Label="la_fld_BindToSystemEvent" Module="Core" Type="1" Hint="U3lzdGVtIEV2ZW50IGluICJwcmVmaXhbLnNwZWNpYWxdOk9uRXZlbnROYW1lIiBmb3JtYXQ=" Column="QmluZCB0byBTeXN0ZW0gRXZlbnQ=">QmluZCB0byBTeXN0ZW0gRXZlbnQ=</PHRASE>
<PHRASE Label="la_fld_BlockPosition" Module="Core" Type="1">RWxlbWVudCBQb3NpdGlvbg==</PHRASE>
<PHRASE Label="la_fld_BorderBottom" Module="Core" Type="1">Qm9yZGVyIEJvdHRvbQ==</PHRASE>
<PHRASE Label="la_fld_BorderLeft" Module="Core" Type="1">Qm9yZGVyIExlZnQ=</PHRASE>
@@ -348,7 +348,7 @@
<PHRASE Label="la_fld_BounceInfo" Module="Core" Type="1" Column="Qm91bmNlIEluZm8=">Qm91bmNlIEluZm8=</PHRASE>
<PHRASE Label="la_fld_Category" Module="Core" Type="1" Column="U2VjdGlvbg==">U2VjdGlvbg==</PHRASE>
<PHRASE Label="la_fld_CategoryFormat" Module="Core" Type="1">U2VjdGlvbiBGb3JtYXQ=</PHRASE>
- <PHRASE Label="la_fld_CategoryId" Module="Core" Type="1">U2VjdGlvbiBJRA==</PHRASE>
+ <PHRASE Label="la_fld_CategoryId" Module="Core" Type="1" Column="U2VjdGlvbiBJRA==">U2VjdGlvbiBJRA==</PHRASE>
<PHRASE Label="la_fld_CategorySeparator" Module="Core" Type="1">U2VjdGlvbiBzZXBhcmF0b3I=</PHRASE>
<PHRASE Label="la_fld_CategoryTemplate" Module="Core" Type="1">U2VjdGlvbiBUZW1wbGF0ZQ==</PHRASE>
<PHRASE Label="la_fld_Cc" Module="Core" Type="1" Column="Q2M=">Q2M=</PHRASE>
@@ -390,6 +390,7 @@
<PHRASE Label="la_fld_ElapsedTime" Module="Core" Type="1">RWxhcHNlZCBUaW1l</PHRASE>
<PHRASE Label="la_fld_Email" Module="Core" Type="1" Column="RW1haWw=">RS1tYWls</PHRASE>
<PHRASE Label="la_fld_EmailCommunicationRole" Module="Core" Type="1" Column="RS1tYWlsIENvbW11bmljYXRpb24gUm9sZQ==">RS1tYWlsIENvbW11bmljYXRpb24gUm9sZQ==</PHRASE>
+ <PHRASE Label="la_fld_EmailEvent" Module="Core" Type="1" Column="RS1tYWlsIEV2ZW50">RS1tYWlsIEV2ZW50</PHRASE>
<PHRASE Label="la_fld_EmailOrUsername" Module="Core" Type="1">RS1tYWlsIG9yIFVzZXJuYW1l</PHRASE>
<PHRASE Label="la_fld_EmailPassword" Module="Core" Type="1">RS1tYWlsICI8c3Ryb25nPntwYXNzd29yZH08L3N0cm9uZz4iIHBhc3N3b3JkIHRvIHVzZXI=</PHRASE>
<PHRASE Label="la_fld_EmailsQueued" Module="Core" Type="1" Column="UXVldWU=">RW1haWxzIGluIFF1ZXVl</PHRASE>
@@ -552,6 +553,8 @@
<PHRASE Label="la_fld_PageExpiration" Module="Core" Type="1" Hint="SG93IHNvb24gKGluIHNlY29uZHMpIHRoZSBzZWN0aW9uIGNhY2hlIHNob3VsZCBhdXRvLWV4cGlyZSBhZnRlciBpdCdzIGNyZWF0aW9uLiBCeSBkZWZhdWx0IHN5c3RlbSB0ZW5kcyB0byByZWJ1aWxkIHRoZSBjYWNoZSBvbmx5IHdoZW4gaXQncyBwcm9wZXJ0aWVzIG9yIGVsZW1lbnRzIGhhdmUgY2hhbmdlZC4=">Q2FjaGUgRXhwaXJhdGlvbiBpbiBzZWNvbmRz</PHRASE>
<PHRASE Label="la_fld_PageMentTitle" Module="Core" Type="1">VGl0bGUgKE1lbnUgSXRlbSk=</PHRASE>
<PHRASE Label="la_fld_PageTitle" Module="Core" Type="1" Column="U2VjdGlvbiBUaXRsZQ==">U2VjdGlvbiBUaXRsZQ==</PHRASE>
+ <PHRASE Label="la_fld_ParentItemId" Module="Core" Type="1" Column="UGFyZW50IEl0ZW0gSUQ=">UGFyZW50IEl0ZW0gSUQ=</PHRASE>
+ <PHRASE Label="la_fld_ParentItemName" Module="Core" Type="1" Column="UGFyZW50IEl0ZW0gTmFtZQ==">UGFyZW50IEl0ZW0gTmFtZQ==</PHRASE>
<PHRASE Label="la_fld_ParentSection" Module="Core" Type="1">UGFyZW50IFNlY3Rpb24=</PHRASE>
<PHRASE Label="la_fld_Password" Module="Core" Type="1">UGFzc3dvcmQ=</PHRASE>
<PHRASE Label="la_fld_PercentsCompleted" Module="Core" Type="1">UGVyY2VudHMgQ29tcGxldGVk</PHRASE>
@@ -630,9 +633,11 @@
<PHRASE Label="la_fld_Subject" Module="Core" Type="1" Column="U3ViamVjdA==">U3ViamVjdA==</PHRASE>
<PHRASE Label="la_fld_SubmissionTime" Module="Core" Type="1">U3VibWl0dGVkIE9u</PHRASE>
<PHRASE Label="la_fld_SubmitNotifyEmail" Module="Core" Type="1" Hint="RW1haWwgYWRkcmVzcyB3aGVyZSBub3RpZmljYXRpb24gYWJvdXQgbmV3IHN1Ym1pc3Npb25zIHdpbGwgYmUgc2VuZCB0by4gRGVmYXVsdCBlbWFpbCBhZGRyZXNzIHdpbGwgYmUgdXNlZCBpZiB0aGlzIGZpZWxkIGlzIGxlZnQgYmxhbmsu" Column="U3VibWlzc2lvbiBOb3RpZmljYXRpb24gRW1haWw=">U3VibWlzc2lvbiBOb3RpZmljYXRpb24gRW1haWw=</PHRASE>
+ <PHRASE Label="la_fld_SubscribedOn" Module="Core" Type="1" Column="U3Vic2NyaWJlZCBPbg==">U3Vic2NyaWJlZCBPbg==</PHRASE>
<PHRASE Label="la_fld_SuggestedCorrection" Module="Core" Type="1" Column="U3VnZ2VzdGVkIENvcnJlY3Rpb24=">U3VnZ2VzdGVkIENvcnJlY3Rpb24=</PHRASE>
<PHRASE Label="la_fld_SymLinkCategoryId" Module="Core" Type="1">UG9pbnRzIHRvIFNlY3Rpb24=</PHRASE>
<PHRASE Label="la_fld_SynchronizationModes" Module="Core" Type="1" Hint="IlRvIG90aGVycyIgLSBhbGxvdyB0cmFuc2xhdGVkIHBocmFzZXMgZnJvbSB0aGlzIGxhbmd1YWdlIHRvIGJlIHVzZWQgaW5zdGVhZCBvZiBtaXNzaW5nIHBocmFzZXMgb24gb3RoZXIgbGFuZ3VhZ2VzLiAiRnJvbSBvdGhlcnMiIC0gdXNlIHRyYW5zbGF0ZWQgcGhyYXNlcyBmcm9tIG90aGVyIGxhbmd1YWdlcyBpbnN0ZWFkIG9mIG1pc3NpbmcgcGhyYXNlcyBvbiB0aGlzIGxhbmd1YWdlLg==" Column="U3luY2hyb25pemUgTGFuZ3VhZ2U=">U3luY2hyb25pemUgTGFuZ3VhZ2U=</PHRASE>
+ <PHRASE Label="la_fld_SystemEvent" Module="Core" Type="1" Column="U3lzdGVtIEV2ZW50">U3lzdGVtIEV2ZW50</PHRASE>
<PHRASE Label="la_fld_TableName" Module="Core" Type="1">VGFibGUgTmFtZSBpbiBEYXRhYmFzZSA=</PHRASE>
<PHRASE Label="la_fld_Tag" Module="Core" Type="1">VGFn</PHRASE>
<PHRASE Label="la_fld_TargetId" Module="Core" Type="1" Column="SXRlbQ==">SXRlbQ==</PHRASE>
@@ -1260,6 +1265,7 @@
<PHRASE Label="la_title_AddingSkin" Module="Core" Type="1">QWRkaW5nIFNraW4=</PHRASE>
<PHRASE Label="la_title_AddingSpellingDictionary" Module="Core" Type="1">QWRkaW5nIFNwZWxsaW5nIERpY3Rpb25hcnk=</PHRASE>
<PHRASE Label="la_title_AddingStopWord" Module="Core" Type="1">QWRkaW5nIFN0b3AgV29yZA==</PHRASE>
+ <PHRASE Label="la_title_AddingSystemEventSubscription" Module="Core" Type="1">QWRkaW5nIFN5c3RlbSBFdmVudCBTdWJzY3JpcHRpb24=</PHRASE>
<PHRASE Label="la_title_AddingThemeFile" Module="Core" Type="1">QWRkaW5nIFRoZW1lIFRlbXBsYXRl</PHRASE>
<PHRASE Label="la_title_AddingThesaurus" Module="Core" Type="1">QWRkaW5nIFRoZXNhdXJ1cw==</PHRASE>
<PHRASE Label="la_title_Adding_BaseStyle" Module="Core" Type="1">QWRkaW5nIEJhc2UgU3R5bGU=</PHRASE>
@@ -1315,6 +1321,7 @@
<PHRASE Label="la_title_EditingSpellingDictionary" Module="Core" Type="1">RWRpdGluZyBTcGVsbGluZyBEaWN0aW9uYXJ5</PHRASE>
<PHRASE Label="la_title_EditingStopWord" Module="Core" Type="1">RWRpdGluZyBTdG9wIFdvcmQ=</PHRASE>
<PHRASE Label="la_title_EditingStyle" Module="Core" Type="1">RWRpdGluZyBTdHlsZQ==</PHRASE>
+ <PHRASE Label="la_title_EditingSystemEventSubscription" Module="Core" Type="1">RWRpdGluZyBTeXN0ZW0gRXZlbnQgU3Vic2NyaXB0aW9u</PHRASE>
<PHRASE Label="la_title_EditingThemeFile" Module="Core" Type="1">RWRpdGluZyBUaGVtZSBGaWxl</PHRASE>
<PHRASE Label="la_title_EditingThesaurus" Module="Core" Type="1">RWRpdGluZyBUaGVzYXVydXM=</PHRASE>
<PHRASE Label="la_title_EditingTranslation" Module="Core" Type="1">RWRpdGluZyBUcmFuc2xhdGlvbg==</PHRASE>
@@ -1395,6 +1402,7 @@
<PHRASE Label="la_title_SpellingDictionary" Module="Core" Type="1">U3BlbGxpbmcgRGljdGlvbmFyeQ==</PHRASE>
<PHRASE Label="la_title_StopWords" Module="Core" Type="1">U3RvcCBXb3Jkcw==</PHRASE>
<PHRASE Label="la_title_Structure" Module="Core" Type="1">U3RydWN0dXJlICYgRGF0YQ==</PHRASE>
+ <PHRASE Label="la_title_SystemEventSubscriptions" Module="Core" Type="1">VXNlciBTdWJzY3JpcHRpb25z</PHRASE>
<PHRASE Label="la_title_SystemTools" Module="Core" Type="1">U3lzdGVtIFRvb2xz</PHRASE>
<PHRASE Label="la_title_SystemToolsClearTemplatesCache" Module="Core" Type="1" Hint="PHVsPg0KICA8bGk+RGVsZXRlcyBhbGwgY29tcGlsZWQgdGVtcGxhdGVzIGZyb20gQWRtaW4gQ29uc29sZSBhbmQgRnJvbnQtZW5kIHRoZW1lcy48L2xpPg0KICA8bGk+UmVjb21tZW5kZWQgZm9yIHRoZSBtYWludGVuYW5jZSBwdXJwb3Nlcywgc2luY2UgZG9lcyBub3QgcHJvdmlkZSBhbnkgYWR2YW50YWdlcyBleGNlcHQgZm9yIHRlbXBvcmFyeSBsb3dlcmluZyB1c2FnZSBvZiB0aGUgZGlzayBzcGFjZS4gQWxsIHRlbXBsYXRlcyB3aWxsIGJlIGF1dG9tYXRpY2FsbHkgcmVjb21waWxlZCBhdCB0aGUgdGltZSBvZiB2aXNpdC48L2xpPg0KPC91bD4=">Q2xlYXIgVGVtcGxhdGVzIENhY2hl</PHRASE>
<PHRASE Label="la_title_SystemToolsCommonlyUsedKeys" Module="Core" Type="1">Q29tbW9ubHkgVXNlZCBLZXlz</PHRASE>
Index: core/install/install_data.sql
===================================================================
--- core/install/install_data.sql (revision 15235)
+++ core/install/install_data.sql (working copy)
@@ -702,6 +702,11 @@
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.edit', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.delete', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.delete', 11, 1, 1, 0);
+
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:email_queue.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:email_queue.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:session_logs.view', 11, 1, 1, 0);
Index: core/install/install_schema.sql
===================================================================
--- core/install/install_schema.sql (revision 15252)
+++ core/install/install_schema.sql (working copy)
@@ -140,7 +140,7 @@
KEY l5_PlainTextBody (l5_PlainTextBody(5))
);
-CREATE TABLE EmailEventSubscribers (
+CREATE TABLE SystemEventSubscriptions (
SubscriptionId int(11) NOT NULL AUTO_INCREMENT,
EmailEventId int(11) DEFAULT NULL,
SubscriberEmail varchar(255) NOT NULL DEFAULT '',
Index: core/install/remove_schema.sql
===================================================================
--- core/install/remove_schema.sql (revision 15252)
+++ core/install/remove_schema.sql (working copy)
@@ -4,7 +4,7 @@
DROP TABLE SystemSettings;
DROP TABLE EmailQueue;
DROP TABLE EmailEvents;
-DROP TABLE EmailEventSubscribers;
+DROP TABLE SystemEventSubscriptions;
DROP TABLE IdGenerator;
DROP TABLE Languages;
DROP TABLE Modules;
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql (revision 15253)
+++ core/install/upgrades.sql (working copy)
@@ -2712,7 +2712,7 @@
ALTER TABLE EmailEvents ADD BindToSystemEvent VARCHAR(255) NOT NULL DEFAULT '';
-CREATE TABLE EmailEventSubscribers (
+CREATE TABLE SystemEventSubscriptions (
SubscriptionId int(11) NOT NULL AUTO_INCREMENT,
EmailEventId int(11) DEFAULT NULL,
SubscriberEmail varchar(255) NOT NULL DEFAULT '',
@@ -2724,3 +2724,17 @@
PRIMARY KEY (SubscriptionId),
KEY EmailEventId (EmailEventId)
);
+
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.view', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.add', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.edit', 11, 1, 1, 0);
+INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:system_event_subscriptions.delete', 11, 1, 1, 0);
+
+UPDATE LanguageLabels
+SET
+ l1_ColumnTranslation = l1_Translation,
+ l2_ColumnTranslation = l2_Translation,
+ l3_ColumnTranslation = l3_Translation,
+ l4_ColumnTranslation = l4_Translation,
+ l5_ColumnTranslation = l5_Translation
+WHERE PhraseKey IN ('LA_FLD_BINDTOSYSTEMEVENT', 'LA_FLD_CATEGORYID');
Index: core/kernel/db/db_event_handler.php
===================================================================
--- core/kernel/db/db_event_handler.php (revision 15252)
+++ core/kernel/db/db_event_handler.php (working copy)
@@ -2446,17 +2446,52 @@
$object = $event->getObject();
/* @var $object kDBItem */
+ // 1. delete direct subscriptions to item, that was deleted
+ $this->_deleteSubscriptions($event->Prefix, 'ItemId', $object->GetID());
+
+ $sub_items = $this->Application->getUnitOption($event->Prefix, 'SubItems', Array ());
+ /* @var $sub_items Array */
+
+ // 2. delete this item sub-items subscriptions, that reference item, that was deleted
+ foreach ($sub_items as $sub_prefix) {
+ $this->_deleteSubscriptions($sub_prefix, 'ParentItemId', $object->GetID());
+ }
+ }
+
+ /**
+ * Deletes all subscriptions, associated with given item
+ *
+ * @param string $prefix
+ * @param string $field
+ * @param int $value
+ * @return void
+ * @access protected
+ */
+ protected function _deleteSubscriptions($prefix, $field, $value)
+ {
$sql = 'SELECT EventId
FROM ' . TABLE_PREFIX . 'EmailEvents
- WHERE BindToSystemEvent REGEXP "' . $this->Conn->escape($event->Prefix) . '[.]{0,1}([^:]*):(.*)"';
+ WHERE BindToSystemEvent REGEXP "' . $this->Conn->escape($prefix) . '(\\\\.[^:]*:.*|:.*)"';
$email_event_ids = $this->Conn->GetCol($sql);
- if ( $email_event_ids ) {
- // e-mail events, connected to that unit prefix are found
- $sql = 'DELETE FROM ' . TABLE_PREFIX . 'EmailEventSubscribers
- WHERE ItemId = ' . $object->GetID() . ' AND EmailEventId IN (' . implode(',', $email_event_ids) . ')';
- $this->Conn->Query($sql);
+ if ( !$email_event_ids ) {
+ return;
}
+
+ // e-mail events, connected to that unit prefix are found
+ $sql = 'SELECT SubscriptionId
+ FROM ' . TABLE_PREFIX . 'SystemEventSubscriptions
+ WHERE ' . $field . ' = ' . $value . ' AND EmailEventId IN (' . implode(',', $email_event_ids) . ')';
+ $ids = $this->Conn->GetCol($sql);
+
+ if ( !$ids ) {
+ return;
+ }
+
+ $temp_handler = $this->Application->recallObject('system-event-subscription_TempHandler', 'kTempTablesHandler');
+ /* @var $temp_handler kTempTablesHandler */
+
+ $temp_handler->DeleteItems('system-event-subscription', '', $ids);
}
/**
Index: core/kernel/db/dblist.php
===================================================================
--- core/kernel/db/dblist.php (revision 15226)
+++ core/kernel/db/dblist.php (working copy)
@@ -18,7 +18,7 @@
* DBList
*
*/
-class kDBList extends kDBBase {
+class kDBList extends kDBBase implements Iterator, Countable {
// kDBList filter types (then, types are divided into classes)
@@ -1493,6 +1493,79 @@
{
$this->mainList = true;
}
+
+ /**
+ * Moves recordset pointer to first element
+ *
+ * @return void
+ * @access public
+ * @implements Iterator::rewind
+ */
+ public function rewind()
+ {
+ $this->Query();
+ $this->GoFirst();
+ }
+
+ /**
+ * Returns value at current position
+ *
+ * @return mixed
+ * @access public
+ * @implements Iterator::current
+ */
+ function current()
+ {
+ return $this->getCurrentRecord();
+ }
+
+ /**
+ * Returns key at current position
+ *
+ * @return mixed
+ * @access public
+ * @implements Iterator::key
+ */
+ function key()
+ {
+ return $this->CurrentIndex;
+ }
+
+ /**
+ * Moves recordset pointer to next position
+ *
+ * @return void
+ * @access public
+ * @implements Iterator::next
+ */
+ function next()
+ {
+ $this->GoNext();
+ }
+
+ /**
+ * Detects if current position is within recordset bounds
+ *
+ * @return bool
+ * @access public
+ * @implements Iterator::valid
+ */
+ public function valid()
+ {
+ return !$this->EOL();
+ }
+
+ /**
+ * Counts recordset rows
+ *
+ * @return int
+ * @access public
+ * @implements Countable::count
+ */
+ public function count()
+ {
+ return $this->SelectedCount;
+ }
}
Index: core/kernel/event_handler.php
===================================================================
--- core/kernel/event_handler.php (revision 15252)
+++ core/kernel/event_handler.php (working copy)
@@ -219,7 +219,7 @@
protected function OnGetEventSubscribersQuery(kEvent $event)
{
$sql = 'SELECT SubscriberEmail, UserId
- FROM ' . TABLE_PREFIX . 'EmailEventSubscribers
+ FROM ' . $this->Application->getUnitOption('system-event-subscription', 'TableName') . '
WHERE (' . implode(') AND (', $event->getEventParam('where_clause')) . ')';
$event->setEventParam('sql', $sql);
}
Index: core/units/categories/categories_event_handler.php
===================================================================
--- core/units/categories/categories_event_handler.php (revision 15260)
+++ core/units/categories/categories_event_handler.php (working copy)
@@ -953,6 +953,19 @@
SET SymLinkCategoryId = NULL
WHERE SymLinkCategoryId = ' . $object->GetID();
$this->Conn->Query($sql);
+
+ // delete direct subscriptions to category, that was deleted
+ $sql = 'SELECT SubscriptionId
+ FROM ' . TABLE_PREFIX . 'SystemEventSubscriptions
+ WHERE CategoryId = ' . $object->GetID();
+ $ids = $this->Conn->GetCol($sql);
+
+ if ( $ids ) {
+ $temp_handler = $this->Application->recallObject('system-event-subscription_TempHandler', 'kTempTablesHandler');
+ /* @var $temp_handler kTempTablesHandler */
+
+ $temp_handler->DeleteItems('system-event-subscription', '', $ids);
+ }
}
/**
Index: core/units/email_events/email_events_event_handler.php
===================================================================
--- core/units/email_events/email_events_event_handler.php (revision 15252)
+++ core/units/email_events/email_events_event_handler.php (working copy)
@@ -709,8 +709,18 @@
$object = $event->getObject();
/* @var $object kDBItem */
- $sql = 'DELETE FROM ' . TABLE_PREFIX . 'EmailEventSubscribers
+ $sql = 'SELECT SubscriptionId
+ FROM ' . TABLE_PREFIX . 'SystemEventSubscriptions
WHERE EmailEventId = ' . $object->GetID();
- $this->Conn->Query($sql);
+ $ids = $this->Conn->GetCol($sql);
+
+ if ( !$ids ) {
+ return;
+ }
+
+ $temp_handler = $this->Application->recallObject('system-event-subscription_TempHandler', 'kTempTablesHandler');
+ /* @var $temp_handler kTempTablesHandler */
+
+ $temp_handler->DeleteItems('system-event-subscription', '', $ids);
}
}
\ No newline at end of file
Property changes on: core\units\system_event_subscriptions
___________________________________________________________________
Added: tsvn:autoprops
+ *.php = svn:eol-style=LF;svn:keywords=Id
*.tpl = svn:eol-style=LF
*.sql = svn:eol-style=LF
*.lang = svn:eol-style=LF
*.sh = svn:eol-style=LF;svn:executable
*.txt = svn:eol-style=LF
*.html = svn:eol-style=LF
*.htm = svn:eol-style=LF
*.css = svn:eol-style=LF
*.js = svn:eol-style=LF
*.xml = svn:eol-style=LF
.htaccess = svn:eol-style=LF
.smsignore = svn:eol-style=LF
COPYRIGHT = svn:eol-style=LF
CREDITS = svn:eol-style=LF
INSTALL = svn:eol-style=LF
LICENSE = svn:eol-style=LF
LICENSES = svn:eol-style=LF
README = svn:eol-style=LF
Added: bugtraq:url
+ http://tracker.in-portal.org/view.php?id=%BUGID%
Added: bugtraq:number
+ true
Added: bugtraq:logregex
+ (?:[Bb]ugs?|[Ii]ssues?|[Rr]eports?|[Ff]ixe?s?|[Rr]esolves?)+\s+(?:#?(?:\d+)[,\.\s]*)+
(\d+)
Index: core/units/system_event_subscriptions/system_event_subscription_eh.php
===================================================================
--- core/units/system_event_subscriptions/system_event_subscription_eh.php (revision 0)
+++ core/units/system_event_subscriptions/system_event_subscription_eh.php (revision 0)
@@ -0,0 +1,102 @@
+<?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 SystemEventSubscriptionEventHandler extends kDBEventHandler {
+
+ /**
+ * Makes either user or e-mail required
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnAfterItemLoad(kEvent $event)
+ {
+ parent::OnAfterItemLoad($event);
+
+ $this->_setRequired($event);
+ }
+
+ /**
+ * Makes either user or e-mail required
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnPreCreate(kEvent $event)
+ {
+ parent::OnPreCreate($event);
+
+ $this->_setRequired($event);
+ }
+
+ /**
+ * Makes either user or e-mail required
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnBeforeItemCreate(kEvent $event)
+ {
+ parent::OnBeforeItemCreate($event);
+
+ $this->_itemChanged($event);
+ }
+
+ /**
+ * Makes either user or e-mail required
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnBeforeItemUpdate(kEvent $event)
+ {
+ parent::OnBeforeItemUpdate($event);
+
+ $this->_itemChanged($event);
+ }
+
+ /**
+ * Makes either user or e-mail required
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function _itemChanged(kEvent $event)
+ {
+ $this->_setRequired($event);
+ }
+
+ /**
+ * Makes either user or e-mail required
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function _setRequired(kEvent $event)
+ {
+ $object = $event->getObject();
+ /* @var $object kDBItem */
+
+ $object->setRequired('UserId', !$object->GetDBField('SubscriberEmail'));
+ $object->setRequired('SubscriberEmail', !$object->GetDBField('UserId'));
+ }
+}
\ No newline at end of file
Property changes on: core\units\system_event_subscriptions\system_event_subscription_eh.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ LF
Index: core/units/system_event_subscriptions/system_event_subscription_tp.php
===================================================================
--- core/units/system_event_subscriptions/system_event_subscription_tp.php (revision 0)
+++ core/units/system_event_subscriptions/system_event_subscription_tp.php (revision 0)
@@ -0,0 +1,252 @@
+<?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 SystemEventSubscriptionTagProcessor extends kDBTagProcessor {
+
+ /**
+ * Holds reference to subscription analyzer
+ *
+ * @var kSubscriptionAnalyzer
+ */
+ protected $_analyzer = null;
+
+ /**
+ * Allows to show category path of selected module
+ *
+ * @param Array $params
+ * @return string
+ */
+ function CategoryPath($params)
+ {
+ $object = $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $category_id = $object->GetDBField('CategoryId');
+
+ if ( !is_numeric($category_id) ) {
+ return '';
+ }
+
+ $params['cat_id'] = $category_id;
+
+ return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
+ }
+
+ /**
+ * Prints item name
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function ItemName($params)
+ {
+ $object = $this->getObject($params);
+ /* @var $object kDBList */
+
+ if ( !isset($this->_analyzer) ) {
+ $this->_analyzer = new kSubscriptionAnalyzer($object);
+ $this->_analyzer->run();
+ }
+
+ return $this->_analyzer->getTitle($this->SelectParam($params, 'name,field'));
+ }
+}
+
+
+class kSubscriptionAnalyzer extends kBase {
+
+ /**
+ * Reference to a list object
+ *
+ * @var kDBList
+ * @access protected
+ */
+ protected $_subscriptions = null;
+
+ /**
+ * Remember what to what ids subscription exists for each of subscribed prefixes
+ *
+ * @var Array
+ * @access protected
+ */
+ protected $_prefixToIdsMap = Array ();
+
+ /**
+ * Reverse index that remembers what prefix is used in what row (fields: ItemId, ParentItemId)
+ *
+ * @var Array
+ * @access protected
+ */
+ protected $_prefixToRowMap = Array ();
+
+ /**
+ * Holds title of each item in list in format [prefix][id] = title
+ *
+ * @var Array
+ * @access protected
+ */
+ protected $_itemTitles = Array ();
+
+ /**
+ * Set's references to kApplication and kDBConnection class instances
+ *
+ * @param kDBList $subscriptions
+ * @access public
+ * @see kApplication
+ * @see kDBConnection
+ */
+ public function __construct($subscriptions)
+ {
+ parent::__construct();
+
+ $this->_subscriptions = $subscriptions;
+ }
+
+ /**
+ * Analyzes list
+ *
+ * @return void
+ * @access public
+ */
+ public function run()
+ {
+ foreach ($this->_subscriptions as $subscription) {
+ $prefix = $this->_getPrefix();
+ $parent_prefix = $this->Application->getUnitOption($prefix, 'ParentPrefix');
+
+ $this->_addIdToPrefix($prefix, 'ItemId');
+ $this->_addIdToPrefix($parent_prefix, 'ParentItemId');
+ }
+
+ $this->_queryItemTitles();
+ $this->_subscriptions->GoFirst();
+ }
+
+ /**
+ * Returns item title, associated with item's ID in given field
+ *
+ * @param string $field
+ * @return string
+ */
+ public function getTitle($field)
+ {
+ $row_index = $this->_subscriptions->key();
+
+ if ( !isset($this->_prefixToRowMap[$row_index][$field]) ) {
+ return '';
+ }
+
+ $prefix = $this->_prefixToRowMap[$row_index][$field];
+ $value = $this->_subscriptions->GetDBField($field);
+
+ return $this->_itemTitles[$prefix][$value];
+ }
+
+ /**
+ * Queries titles for each of subscribed items
+ *
+ * @return void
+ * @access protected
+ */
+ protected function _queryItemTitles()
+ {
+ foreach ($this->_prefixToIdsMap as $prefix => $ids) {
+ $id_field = $this->Application->getUnitOption($prefix, 'IDField');
+
+ $sql = 'SELECT ' . $this->_getTitleField($prefix) . ', ' . $id_field . '
+ FROM ' . $this->Application->getUnitOption($prefix, 'TableName') . '
+ WHERE ' . $id_field . ' IN (' . implode(',', $ids) . ')';
+ $this->_itemTitles[$prefix] = $this->Conn->GetCol($sql, $id_field);
+ }
+ }
+
+ /**
+ * Adds ID from a gvein field (when it isn't NULL) to prefix ids
+ *
+ * @param string $prefix
+ * @param string $field
+ * @return void
+ * @access protected
+ */
+ protected function _addIdToPrefix($prefix, $field)
+ {
+ $id = $this->_subscriptions->GetDBField($field);
+
+ if ( !$id || !$prefix ) {
+ return;
+ }
+
+ // add id to prefix ids list
+ if ( !isset($this->_prefixToIdsMap[$prefix]) ) {
+ $this->_prefixToIdsMap[$prefix] = Array ();
+ }
+
+ if ( !in_array($id, $this->_prefixToIdsMap[$prefix]) ) {
+ $this->_prefixToIdsMap[$prefix][] = $id;
+ }
+
+ // remeber prefix associated with this field
+ $row_index = $this->_subscriptions->key();
+
+ if ( !isset($this->_prefixToRowMap[$row_index]) ) {
+ $this->_prefixToRowMap[$row_index] = Array ();
+ }
+
+ $this->_prefixToRowMap[$row_index][$field] = $prefix;
+ }
+
+ /**
+ * Returns prefix of main item in current row
+ *
+ * @return string
+ * @access protected
+ */
+ protected function _getPrefix()
+ {
+ $event = new kEvent($this->_subscriptions->GetDBField('BindToSystemEvent'));
+
+ return $event->Prefix;
+ }
+
+ /**
+ * Returns title field of given prefix
+ *
+ * @param string $prefix
+ * @return array
+ */
+ protected function _getTitleField($prefix)
+ {
+ $lang_prefix = '';
+ $title_field = $this->Application->getUnitOption($prefix, 'TitleField');
+
+ if ( preg_match('/^(l[\d]+_)(.*)/', $title_field, $regs) ) {
+ // object was initialized and we have lang prefix in unit config
+ $lang_prefix = $regs[1];
+ $title_field = $regs[2];
+ }
+ else {
+ // object wasn't initialized -> check other way OR not ml title field
+ $fields = $this->Application->getUnitOption($prefix, 'Fields');
+
+ if ( isset($fields[$title_field]['formatter']) && $fields[$title_field]['formatter'] == 'kMultiLanguage' ) {
+ $lang_prefix = 'l' . $this->Application->GetVar('m_lang') . '_';
+ }
+ }
+
+ return $lang_prefix . $title_field;
+ }
+}
\ No newline at end of file
Property changes on: core\units\system_event_subscriptions\system_event_subscription_tp.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ LF
Index: core/units/system_event_subscriptions/system_event_subscriptions_config.php
===================================================================
--- core/units/system_event_subscriptions/system_event_subscriptions_config.php (revision 0)
+++ core/units/system_event_subscriptions/system_event_subscriptions_config.php (revision 0)
@@ -0,0 +1,136 @@
+<?php
+/**
+* @version $Id$
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2011 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!');
+
+$config = Array (
+ 'Prefix' => 'system-event-subscription',
+ 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
+ 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
+ 'EventHandlerClass' => Array ('class' => 'SystemEventSubscriptionEventHandler', 'file' => 'system_event_subscription_eh.php', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array ('class' => 'SystemEventSubscriptionTagProcessor', 'file' => 'system_event_subscription_tp.php', 'build_event' => 'OnBuild'),
+
+ 'AutoLoad' => true,
+
+ 'QueryString' => Array (
+ 1 => 'id',
+ 2 => 'Page',
+ 3 => 'PerPage',
+ 4 => 'event',
+ 5 => 'mode',
+ ),
+
+ 'IDField' => 'SubscriptionId',
+
+ 'TableName' => TABLE_PREFIX . 'SystemEventSubscriptions',
+
+ 'TitleField' => 'SubscriptionId',
+
+ 'TitlePresets' => Array (
+ 'default' => Array (
+ 'new_status_labels' => Array ('system-event-subscription' => '!la_title_AddingSystemEventSubscription!'),
+ 'edit_status_labels' => Array ('system-event-subscription' => '!la_title_EditingSystemEventSubscription!'),
+ ),
+
+ 'system_event_subscription_list' => Array (
+ 'prefixes' => Array ('system-event-subscription_List'), 'format' => "!la_title_SystemEventSubscriptions!",
+ 'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'view', 'dbl-click'),
+ ),
+
+ 'system_event_subscription_edit' => Array (
+ 'prefixes' => Array ('system-event-subscription'), 'format' => "#system-event-subscription_status# '#system-event-subscription_titlefield#'",
+ 'toolbar_buttons' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'),
+ ),
+ ),
+
+ 'PermSection' => Array('main' => 'in-portal:system_event_subscriptions'),
+
+ 'Sections' => Array (
+ 'in-portal:system_event_subscriptions' => Array (
+ 'parent' => 'in-portal:users',
+ 'icon' => 'system_event_subscriptions',
+ 'label' => 'la_title_SystemEventSubscriptions',
+ 'url' => Array('t' => 'system_event_subscriptions/system_event_subscription_list', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 6,
+ 'type' => stTREE,
+ ),
+ ),
+
+ 'ListSQLs' => Array (
+ '' => ' SELECT %1$s.* %2$s
+ FROM %1$s
+ LEFT JOIN ' . TABLE_PREFIX . 'EmailEvents ee ON %1$s.EmailEventId = ee.EventId
+ LEFT JOIN ' . TABLE_PREFIX . 'Users u ON %1$s.UserId = u.PortalUserId
+ LEFT JOIN ' . TABLE_PREFIX . 'Categories c ON %1$s.CategoryId = c.CategoryId',
+ ),
+
+ 'CalculatedFields' => Array (
+ '' => Array (
+ 'BindToSystemEvent' => 'ee.BindToSystemEvent',
+ 'EmailEventName' => 'ee.Event',
+ 'Username' => 'CASE %1$s.UserId WHEN ' . USER_ROOT . ' THEN "root" WHEN ' . USER_GUEST . ' THEN "Guest" ELSE IF(CONCAT(u.FirstName, u.LastName) <> "", CONCAT(u.FirstName, " ", u.LastName), IF(%1$s.UserId IS NULL, "Guest", u.Username)) END',
+ 'CategoryName' => 'c.l%2$s_Name',
+ 'ItemName' => '%1$s.ItemId',
+ 'ParentItemName' => '%1$s.ParentItemId',
+ ),
+ ),
+
+ 'ListSortings' => Array (
+ '' => Array (
+ 'Sorting' => Array ('SubscriptionId' => 'desc'),
+ )
+ ),
+
+ 'Fields' => Array (
+ 'SubscriptionId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'EmailEventId' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'EmailEvents WHERE BindToSystemEvent <> "" ORDER BY Event ASC', 'option_key_field' => 'EventId', 'option_title_field' => 'BindToSystemEvent',
+ 'required' => 1, 'default' => NULL
+ ),
+ 'SubscriberEmail' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
+ 'UserId' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
+ 'CategoryId' => Array ('type' => 'int', 'default' => NULL),
+ 'ItemId' => Array ('type' => 'int', 'default' => NULL),
+ 'ParentItemId' => Array ('type' => 'int', 'default' => NULL),
+ 'SubscribedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#')
+ ),
+
+ 'VirtualFields' => Array (
+ 'Username' => Array ('type' => 'string', 'default' => ''),
+ 'EmailEventName' => Array ('type' => 'string', 'default' => ''),
+ 'CategoryName' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'default' => ''),
+ ),
+
+ 'Grids' => Array (
+ 'Default' => Array (
+ 'Fields' => Array (
+ 'SubscriptionId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter', 'width' => 80),
+ 'EmailEventId' => Array ('title' => 'column:la_fld_SystemEvent', 'filter_block' => 'grid_options_filter', 'width' => 170),
+ 'EmailEventName' => Array ('title' => 'column:la_fld_EmailEvent', 'filter_block' => 'grid_like_filter', 'width' => 170),
+ 'SubscriberEmail' => Array ('title' => 'column:la_fld_Email', 'filter_block' => 'grid_like_filter'),
+ 'UserId' => Array ('title' => 'la_col_PortalUserId', 'filter_block' => 'grid_range_filter', 'width' => 80),
+ 'Username' => Array ('filter_block' => 'grid_like_filter'),
+ 'CategoryId' => Array ('title' => 'column:la_fld_CategoryId', /*'data_block' => 'grid_category_td',*/ 'filter_block' => 'grid_range_filter', 'width' => 100),
+ 'CategoryName' => Array ('title' => 'column:la_fld_Category', 'filter_block' => 'grid_like_filter', 'width' => 200),
+ 'ItemId' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
+ 'ItemName' => Array ('data_block' => 'grid_item_name_td', 'associated_field' => 'ItemId', 'filter_block' => 'grid_like_filter', 'width' => 120),
+ 'ParentItemId' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
+ 'ParentItemName' => Array ('data_block' => 'grid_item_name_td', 'associated_field' => 'ParentItemId', 'filter_block' => 'grid_like_filter', 'width' => 120),
+ 'SubscribedOn' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 170)
+ ),
+ ),
+ ),
+);
\ No newline at end of file
Property changes on: core\units\system_event_subscriptions\system_event_subscriptions_config.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ LF
icon24_system_event_subscriptions.png [^] (3,651 bytes) 2012-04-11 10:19

email_event_non_inclusive_category_subscription_option.patch [^] (8,494 bytes) 2012-04-11 11:20
[Show Content]
Index: admin_templates/img/icons/icon24_system_event_subscriptions.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: admin_templates\img\icons\icon24_system_event_subscriptions.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: admin_templates/system_event_subscriptions/system_event_subscription_edit.tpl
===================================================================
--- admin_templates/system_event_subscriptions/system_event_subscription_edit.tpl (revision 15268)
+++ admin_templates/system_event_subscriptions/system_event_subscription_edit.tpl (working copy)
@@ -66,6 +66,7 @@
<inp2:m_RenderElement name="inp_edit_box" prefix="system-event-subscription" field="SubscriberEmail" title="la_fld_Email"/>
<inp2:m_RenderElement name="inp_edit_user" prefix="system-event-subscription" field="UserId" title="la_fld_Username"/>
<inp2:m_RenderElement name="inp_edit_category" prefix="system-event-subscription" field="CategoryId" title="la_fld_Category"/>
+ <inp2:m_RenderElement name="inp_edit_checkbox" prefix="system-event-subscription" field="IncludeSublevels"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="system-event-subscription" field="ItemId" style="width: 50px;"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="system-event-subscription" field="ParentItemId" style="width: 50px;"/>
<inp2:m_RenderElement name="inp_label" prefix="system-event-subscription" field="SubscribedOn"/>
Index: install/english.lang
===================================================================
--- install/english.lang (revision 15268)
+++ install/english.lang (working copy)
@@ -467,6 +467,7 @@
<PHRASE Label="la_fld_ImportFile" Module="Core" Type="1">SW1wb3J0IEZpbGU=</PHRASE>
<PHRASE Label="la_fld_ImportFilename" Module="Core" Type="1">SW1wb3J0IEZpbGVuYW1l</PHRASE>
<PHRASE Label="la_fld_IncludeFieldTitles" Module="Core" Type="1">SW5jbHVkZSBmaWVsZCB0aXRsZXM=</PHRASE>
+ <PHRASE Label="la_fld_IncludeSublevels" Module="Core" Type="1" Column="SW5jbHVkZSBTdWJsZXZlbHM=">SW5jbHVkZSBTdWJsZXZlbHM=</PHRASE>
<PHRASE Label="la_fld_InputDateFormat" Module="Core" Type="1">SW5wdXQgRGF0ZSBGb3JtYXQ=</PHRASE>
<PHRASE Label="la_fld_InputTimeFormat" Module="Core" Type="1">SW5wdXQgVGltZSBGb3JtYXQ=</PHRASE>
<PHRASE Label="la_fld_InstallModules" Module="Core" Type="1">SW5zdGFsbCBNb2R1bGVz</PHRASE>
Index: install/install_schema.sql
===================================================================
--- install/install_schema.sql (revision 15268)
+++ install/install_schema.sql (working copy)
@@ -146,6 +146,7 @@
SubscriberEmail varchar(255) NOT NULL DEFAULT '',
UserId int(11) DEFAULT NULL,
CategoryId int(11) DEFAULT NULL,
+ IncludeSublevels tinyint(4) NOT NULL DEFAULT '1',
ItemId int(11) DEFAULT NULL,
ParentItemId int(11) DEFAULT NULL,
SubscribedOn int(11) DEFAULT NULL,
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 15275)
+++ install/upgrades.sql (working copy)
@@ -2718,6 +2718,7 @@
SubscriberEmail varchar(255) NOT NULL DEFAULT '',
UserId int(11) DEFAULT NULL,
CategoryId int(11) DEFAULT NULL,
+ IncludeSublevels tinyint(4) NOT NULL DEFAULT '1',
ItemId int(11) DEFAULT NULL,
ParentItemId int(11) DEFAULT NULL,
SubscribedOn int(11) DEFAULT NULL,
Index: kernel/event_manager.php
===================================================================
--- kernel/event_manager.php (revision 15252)
+++ kernel/event_manager.php (working copy)
@@ -310,16 +310,17 @@
return;
}
- $category_ids = $item_id = $parent_item_id = false;
$where_clause = Array ();
$where_clause['EmailEventId'] = 'EmailEventId = ' . $email_event['EventId'];
try {
+ $category_ids = Array ();
+
$category = $this->Application->recallObject('c');
/* @var $category kDBItem */
if ( $category->isLoaded() ) {
- $category_ids = trim(str_replace('|', ',', $category->GetDBField('ParentPath')), ',');
+ $category_ids = explode('|', substr($category->GetDBField('ParentPath'), 1, -1));
}
}
catch (Exception $e) {
@@ -328,6 +329,8 @@
$where_clause['CategoryId'] = $this->_getSubscriberFilter('CategoryId', $category_ids, true);
try {
+ $item_id = $parent_item_id = false;
+
$object = $event->getObject();
/* @var $object kDBItem */
@@ -385,17 +388,22 @@
*
* @param string $field
* @param mixed $value
- * @param bool $use_in_clause
+ * @param bool $is_category
* @return string
* @access protected
*/
- protected function _getSubscriberFilter($field, $value, $use_in_clause = false)
+ protected function _getSubscriberFilter($field, $value, $is_category = false)
{
if ( $value ) {
// send to this item subscribers AND to subscribers to all items
- $clause = $use_in_clause ? ' IN (' . $value . ')' : ' = ' . $this->Conn->qstr($value);
+ if ( $is_category ) {
+ $clause = 'IF(IncludeSublevels = 1, ' . $field . ' IN (' . implode(',', $value) . '), ' . $field . ' = ' . end($value) . ')';
+ }
+ else {
+ $clause = $field . ' = ' . $this->Conn->qstr($value);
+ }
- return $field . $clause . ' OR ' . $field . ' IS NULL';
+ return $clause . ' OR ' . $field . ' IS NULL';
}
// send to subscribers to all items
Index: units/system_event_subscriptions/system_event_subscription_tp.php
===================================================================
--- units/system_event_subscriptions/system_event_subscription_tp.php (revision 15274)
+++ units/system_event_subscriptions/system_event_subscription_tp.php (working copy)
@@ -217,11 +217,16 @@
*
* @return string
* @access protected
+ * @throws Exception
*/
protected function _getPrefix()
{
$event = new kEvent($this->_subscriptions->GetDBField('BindToSystemEvent'));
+ if ( !$event->Prefix ) {
+ throw new Exception('Subscription "<strong>#' . $this->_subscriptions->GetID() . '</strong>" is connected to invalid or missing e-mail event "<strong>#' . $this->_subscriptions->GetDBField('EmailEventId') . '</strong>"');
+ }
+
return $event->Prefix;
}
Index: units/system_event_subscriptions/system_event_subscriptions_config.php
===================================================================
--- units/system_event_subscriptions/system_event_subscriptions_config.php (revision 15268)
+++ units/system_event_subscriptions/system_event_subscriptions_config.php (working copy)
@@ -103,6 +103,11 @@
'SubscriberEmail' => Array ('type' => 'string', 'max_len' => 255, 'not_null' => 1, 'default' => ''),
'UserId' => Array ('type' => 'int', 'formatter' => 'kLEFTFormatter', 'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'), 'options' => Array (USER_ROOT => 'root', USER_GUEST => 'Guest'), 'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Users WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Username', 'default' => NULL),
'CategoryId' => Array ('type' => 'int', 'default' => NULL),
+ 'IncludeSublevels' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
+ 'not_null' => 1, 'default' => 1
+ ),
'ItemId' => Array ('type' => 'int', 'default' => NULL),
'ParentItemId' => Array ('type' => 'int', 'default' => NULL),
'SubscribedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#')
@@ -124,6 +129,7 @@
'UserId' => Array ('title' => 'la_col_PortalUserId', 'filter_block' => 'grid_range_filter', 'width' => 80),
'Username' => Array ('filter_block' => 'grid_like_filter'),
'CategoryId' => Array ('title' => 'column:la_fld_CategoryId', /*'data_block' => 'grid_category_td',*/ 'filter_block' => 'grid_range_filter', 'width' => 100),
+ 'IncludeSublevels' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
'CategoryName' => Array ('title' => 'column:la_fld_Category', 'filter_block' => 'grid_like_filter', 'width' => 200),
'ItemId' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'ItemName' => Array ('data_block' => 'grid_item_name_td', 'associated_field' => 'ItemId', 'filter_block' => 'grid_like_filter', 'width' => 120),
|