Просмотр исходного кода

Merge branch 'master' of https://github.com/boonex/dolphin

AntonLV 10 лет назад
Родитель
Сommit
31a51ecbdc

+ 32 - 0
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -185,8 +185,10 @@ class BxBaseModGeneralModule extends BxDolModule
                 array('group' => $sModule . '_object', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'added', 'module_name' => $sModule, 'module_method' => 'get_notifications_post', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
                 array('group' => $sModule . '_object', 'type' => 'update', 'alert_unit' => $sModule, 'alert_action' => 'edited'),
                 array('group' => $sModule . '_object', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'deleted'),
+                
                 array('group' => $sModule . '_comment', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'commentPost', 'module_name' => $sModule, 'module_method' => 'get_notifications_comment', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
                 array('group' => $sModule . '_comment', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'commentRemoved'),
+                
                 array('group' => $sModule . '_vote', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'doVote', 'module_name' => $sModule, 'module_method' => 'get_notifications_vote', 'module_class' => 'Module', 'module_event_privacy' => $sEventPrivacy),
 				array('group' => $sModule . '_vote', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'undoVote'),
             ),
@@ -194,8 +196,10 @@ class BxBaseModGeneralModule extends BxDolModule
                 array('unit' => $sModule, 'action' => 'added'),
                 array('unit' => $sModule, 'action' => 'edited'),
                 array('unit' => $sModule, 'action' => 'deleted'),
+
                 array('unit' => $sModule, 'action' => 'commentPost'),
                 array('unit' => $sModule, 'action' => 'commentRemoved'),
+                
                 array('unit' => $sModule, 'action' => 'doVote'),
                 array('unit' => $sModule, 'action' => 'undoVote'),
             )
@@ -285,6 +289,34 @@ class BxBaseModGeneralModule extends BxDolModule
 		);
     }
 
+    public function _serviceGetNotification($aEvent, $sLangKey)
+    {
+    	$CNF = &$this->_oConfig->CNF;
+
+        $iContentId = (int)$aEvent['object_id'];
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType((int)$iContentId, $this->getName());
+        if (!$oGroupProfile)
+            return false;
+
+        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+        if(empty($aContentInfo) || !is_array($aContentInfo))
+            return array();
+        
+        $oProfile = BxDolProfile::getInstance((int)$aEvent['subobject_id']);
+        if (!$oProfile)
+            return false;
+
+		return array(
+			'entry_sample' => $CNF['T']['txt_sample_single'],
+			'entry_url' => $oGroupProfile->getUrl(),
+			'entry_caption' => $oGroupProfile->getDisplayName(),
+			'entry_author' => $oGroupProfile->id(),
+			'subentry_sample' => $oProfile->getDisplayName(),
+			'subentry_url' => $oProfile->getUrl(),
+			'lang_key' => $sLangKey,
+		);
+    }
+    
     /**
      * Data for Timeline module
      */

+ 3 - 4
modules/base/profile/classes/BxBaseModProfileAlertsResponse.php

@@ -22,15 +22,14 @@ class BxBaseModProfileAlertsResponse extends BxDolAlertsResponse
 
     public function response($oAlert)
     {
-/*
         $CNF = $this->_oModule->_oConfig->CNF;
 
-        // re-translate timeline alert
-        if ('bx_timeline' == $oAlert->sUnit && 'post_common' == $oAlert->sAction && ($oGroupProfile = BxDolProfile::getInstance($oAlert->aExtras['object_author_id']))) {
+        // re-translate timeline alert for timeline in this module for posts made by other profiles
+        if ('bx_timeline' == $oAlert->sUnit && 'post_common' == $oAlert->sAction && ($oGroupProfile = BxDolProfile::getInstance($oAlert->aExtras['object_author_id'])) && $oGroupProfile->getModule() == $this->_oModule->getName() && $oGroupProfile->id() != $oAlert->iSender) {            
             $aContentInfo = $this->_oModule->serviceGetContentInfoById($oGroupProfile->getContentId());
             bx_alert($this->_oModule->getName(), 'timeline_post_common', $aContentInfo[$CNF['FIELD_ID']], $oGroupProfile->id(), array('content' => $aContentInfo, 'group_profile' => $oGroupProfile->id(), 'profile' => $oAlert->iSender, 'notification_subobject_id' => $oAlert->iSender, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
         }
- */
+ 
         if ($this->MODULE != $oAlert->sUnit)
             return;
 

+ 24 - 0
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -319,6 +319,30 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolPro
         return parent::serviceDeleteEntity ($iContentId, 'deleteDataService');
     }
 
+	/**
+     * Data for Notifications module
+     */
+    public function serviceGetNotificationsData()
+    {
+        $a = parent::serviceGetNotificationsData();
+
+        $sModule = $this->_aModule['name'];
+        
+        $a['handlers'][] = array('group' => $sModule . '_timeline_post_common', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'timeline_post_common', 'module_name' => $sModule, 'module_method' => 'get_notifications_timeline_post_common', 'module_class' => 'Module');
+
+        $a['alerts'][] = array('unit' => $sModule, 'action' => 'timeline_post_common');
+
+        return $a;
+    }
+
+    /**
+     * Notification about new member requst in the group
+     */
+    public function serviceGetNotificationsTimelinePostCommon($aEvent)
+    {
+        return $this->_serviceGetNotification($aEvent, '_bx_' . $this->_oConfig->getUri() . '_txt_ntfs_timeline_post_common');
+    }
+    
     // ====== PERMISSION METHODS
 
     /**

+ 0 - 6
modules/boonex/groups/classes/BxGroupsAlertsResponse.php

@@ -23,12 +23,6 @@ class BxGroupsAlertsResponse extends BxBaseModProfileAlertsResponse
 
         $CNF = $this->_oModule->_oConfig->CNF;
 
-        // re-translate timeline alert
-        if ('bx_timeline' == $oAlert->sUnit && 'post_common' == $oAlert->sAction && ($oGroupProfile = BxDolProfile::getInstance($oAlert->aExtras['object_author_id']))) {
-            $aContentInfo = $this->_oModule->serviceGetContentInfoById($oGroupProfile->getContentId());
-            bx_alert($this->_oModule->getName(), 'timeline_post_common', $aContentInfo[$CNF['FIELD_ID']], $oGroupProfile->id(), array('content' => $aContentInfo, 'group_profile' => $oGroupProfile->id(), 'profile' => $oAlert->iSender, 'notification_subobject_id' => $oAlert->iSender, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
-        }
-
         // connection events
         if ('bx_groups_fans' == $oAlert->sUnit && 'connection_added' == $oAlert->sAction) {
             $this->_oModule->serviceAddMutualConnection($oAlert->aExtras['content'], $oAlert->aExtras['initiator']);

+ 0 - 36
modules/boonex/groups/classes/BxGroupsModule.php

@@ -258,14 +258,6 @@ class BxGroupsModule extends BxBaseModProfileModule
         );
     }
 
-    /**
-     * Notification about new member requst in the group
-     */
-    public function serviceGetNotificationsTimelinePostCommon($aEvent)
-    {
-        return $this->_serviceGetNotification($aEvent, '_bx_groups_txt_ntfs_timeline_post_common');
-    }
-
     /**
      * Notification about new member requst in the group
      */
@@ -282,34 +274,6 @@ class BxGroupsModule extends BxBaseModProfileModule
         return $this->_serviceGetNotification($aEvent, '_bx_groups_txt_ntfs_fan_added');
     }
 
-    public function _serviceGetNotification($aEvent, $sLangKey)
-    {
-    	$CNF = &$this->_oConfig->CNF;
-
-        $iContentId = (int)$aEvent['object_id'];
-        $oGroupProfile = BxDolProfile::getInstanceByContentAndType((int)$iContentId, $this->getName());
-        if (!$oGroupProfile)
-            return false;
-
-        $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
-        if(empty($aContentInfo) || !is_array($aContentInfo))
-            return array();
-        
-        $oProfile = BxDolProfile::getInstance((int)$aEvent['subobject_id']);
-        if (!$oProfile)
-            return false;
-
-		return array(
-			'entry_sample' => $CNF['T']['txt_sample_single'],
-			'entry_url' => $oGroupProfile->getUrl(),
-			'entry_caption' => $oGroupProfile->getDisplayName(),
-			'entry_author' => $oGroupProfile->id(), // $aContentInfo[$CNF['FIELD_AUTHOR']],
-			'subentry_sample' => $oProfile->getDisplayName(),
-			'subentry_url' => $oProfile->getUrl(),
-			'lang_key' => $sLangKey,
-		);
-    }
-
     /**
      * Entry post for Timeline module
      */

+ 8 - 0
modules/boonex/organizations/install/config.php

@@ -122,6 +122,14 @@ $aConfig = array(
      * Dependencies Section
      */
     'dependencies' => array(),
+
+    /**
+     * Connections Section
+     */
+    'relations' => array(
+        'bx_timeline',
+        'bx_notifications',
+    ),
 );
 
 /** @} */

+ 2 - 0
modules/boonex/organizations/install/langs/en.xml

@@ -220,5 +220,7 @@
     <string name="_bx_orgs_cat_University"><![CDATA[University]]></string>
     <string name="_bx_orgs_cat_Other"><![CDATA[Other]]></string>
 
+    <string name="_bx_orgs_txt_ntfs_timeline_post_common"><![CDATA[New post in <a class="bx-ntfs-content-profile" href="{owner_link}">{owner_name}</a> organization timeline from <a href="{subentry_url}">{subentry_sample}</a>]]></string>
+    
     <string name="_bx_orgs_txt_sample_single"><![CDATA[organization]]></string>
 </resources>

+ 1 - 1
modules/boonex/organizations/install/sql/enable.sql

@@ -355,7 +355,7 @@ INSERT INTO `sys_alerts_handlers` (`name`, `class`, `file`, `service_call`) VALU
 SET @iHandler := LAST_INSERT_ID();
 
 INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
--- ('bx_timeline', 'post_common', @iHandler),
+('bx_timeline', 'post_common', @iHandler),
 ('bx_organizations', 'timeline_view', @iHandler),
 ('bx_organizations', 'timeline_post', @iHandler),
 ('bx_organizations', 'timeline_delete', @iHandler),

+ 8 - 0
modules/boonex/persons/install/config.php

@@ -122,6 +122,14 @@ $aConfig = array(
      * Dependencies Section
      */
     'dependencies' => array(),
+
+    /**
+     * Connections Section
+     */
+    'relations' => array(
+        'bx_timeline',
+        'bx_notifications',
+    ),
 );
 
 /** @} */

+ 2 - 0
modules/boonex/persons/install/langs/en.xml

@@ -179,5 +179,7 @@
     <string name="_bx_persons_txt_account_pending"><![CDATA[This profile is pending approval, please wait until it is activated.]]></string>
     <string name="_bx_persons_txt_account_suspended"><![CDATA[This profile is suspended.]]></string>
 
+    <string name="_bx_persons_txt_ntfs_timeline_post_common"><![CDATA[New post in <a class="bx-ntfs-content-profile" href="{owner_link}">{owner_name}</a> profile timeline from <a href="{subentry_url}">{subentry_sample}</a>]]></string>
+
     <string name="_bx_persons_txt_sample_single"><![CDATA[person]]></string>
 </resources>

+ 1 - 1
modules/boonex/persons/install/sql/enable.sql

@@ -346,7 +346,7 @@ INSERT INTO `sys_alerts_handlers` (`name`, `class`, `file`, `service_call`) VALU
 SET @iHandler := LAST_INSERT_ID();
 
 INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
--- ('bx_timeline', 'post_common', @iHandler),
+('bx_timeline', 'post_common', @iHandler),
 ('bx_persons', 'timeline_view', @iHandler),
 ('bx_persons', 'timeline_post', @iHandler),
 ('bx_persons', 'timeline_delete', @iHandler),

+ 2 - 0
modules/boonex/russian/data/langs/bx_organizations/ru.xml

@@ -220,5 +220,7 @@
     <string name="_bx_orgs_cat_University"><![CDATA[Преподавание]]></string>
     <string name="_bx_orgs_cat_Other"><![CDATA[Другое]]></string>
 
+    <string name="_bx_orgs_txt_ntfs_timeline_post_common"><![CDATA[В организации <a class="bx-ntfs-content-profile" href="{owner_link}">{owner_name}</a> новая публикация от <a href="{subentry_url}">{subentry_sample}</a>]]></string>
+    
     <string name="_bx_orgs_txt_sample_single"><![CDATA[Организация]]></string>
 </resources>

+ 2 - 0
modules/boonex/russian/data/langs/bx_persons/ru.xml

@@ -180,5 +180,7 @@
     <string name="_bx_persons_txt_account_pending"><![CDATA[Этот профиль ожидает одобрения. Пожалуйста, дождитесь его активации.]]></string>
     <string name="_bx_persons_txt_account_suspended"><![CDATA[Этот профиль заблокирован.]]></string>
 
+    <string name="_bx_persons_txt_ntfs_timeline_post_common"><![CDATA[В профайле <a class="bx-ntfs-content-profile" href="{owner_link}">{owner_name}</a> новая публикация от <a href="{subentry_url}">{subentry_sample}</a>]]></string>
+    
     <string name="_bx_persons_txt_sample_single"><![CDATA[Персона]]></string>
 </resources>