Explorar el Código

#281 Groups: preparing for base module, thumbnail with cover for profiles based modules

Alex Trofimov hace 10 años
padre
commit
c0c72c6f60
Se han modificado 25 ficheros con 196 adiciones y 138 borrados
  1. 12 1
      modules/base/profile/classes/BxBaseModProfilePrivacy.php
  2. 26 5
      modules/base/profile/classes/BxBaseModProfileTemplate.php
  3. 51 0
      modules/base/profile/template/css/main.css
  4. 16 0
      modules/base/profile/template/unit_with_cover.html
  5. 6 6
      modules/boonex/groups/classes/BxGroupsAlertsResponse.php
  6. 21 1
      modules/boonex/groups/classes/BxGroupsConfig.php
  7. 2 2
      modules/boonex/groups/classes/BxGroupsDb.php
  8. 1 1
      modules/boonex/groups/classes/BxGroupsFormEntry.php
  9. 1 1
      modules/boonex/groups/classes/BxGroupsGridCommon.php
  10. 2 2
      modules/boonex/groups/classes/BxGroupsGridConnections.php
  11. 7 7
      modules/boonex/groups/classes/BxGroupsMenuView.php
  12. 10 8
      modules/boonex/groups/classes/BxGroupsModule.php
  13. 2 13
      modules/boonex/groups/classes/BxGroupsPrivacy.php
  14. 8 13
      modules/boonex/groups/classes/BxGroupsTemplate.php
  15. 7 7
      modules/boonex/groups/js/manage_tools.js
  16. 6 47
      modules/boonex/groups/template/css/main.css
  17. 2 14
      modules/boonex/groups/template/unit.html
  18. 2 2
      modules/boonex/organizations/classes/BxOrgsPrivacy.php
  19. 4 2
      modules/boonex/organizations/classes/BxOrgsSearchResult.php
  20. 1 1
      modules/boonex/organizations/install/sql/enable.sql
  21. 1 0
      modules/boonex/organizations/template/unit_with_cover.html
  22. 2 2
      modules/boonex/persons/classes/BxPersonsPrivacy.php
  23. 4 2
      modules/boonex/persons/classes/BxPersonsSearchResult.php
  24. 1 1
      modules/boonex/persons/install/sql/enable.sql
  25. 1 0
      modules/boonex/persons/template/unit_with_cover.html

+ 12 - 1
modules/base/profile/classes/BxBaseModProfilePrivacy.php

@@ -12,7 +12,8 @@
 class BxBaseModProfilePrivacy extends BxTemplPrivacy
 {
 	protected $MODULE;
-	protected $_oModule;
+    protected $_oModule;
+    protected $_aPrivacyParticallyVisible = array ();
 
     public function __construct($aOptions, $oTemplate = false)
     {
@@ -22,6 +23,16 @@ class BxBaseModProfilePrivacy extends BxTemplPrivacy
     	if(!$oTemplate)
 			$oTemplate = $this->_oModule->_oTemplate;
     }
+
+    public function isPartiallyVisible ($mixedPrivacy)
+    {
+        return in_array($mixedPrivacy, $this->_aPrivacyParticallyVisible);
+    }
+
+    public function getPartiallyVisiblePrivacyGroups ()
+    {
+        return $this->_aPrivacyParticallyVisible;
+    }
 }
 
 /** @} */

+ 26 - 5
modules/base/profile/classes/BxBaseModProfileTemplate.php

@@ -24,8 +24,6 @@ class BxBaseModProfileTemplate extends BxBaseModGeneralTemplate
      */
     function unit ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
     {
-        // TODO: add privacy checking here
-
         $aVars = $this->unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
 
         return $this->parseHtmlByName($sTemplateName, $aVars);
@@ -35,18 +33,41 @@ class BxBaseModProfileTemplate extends BxBaseModGeneralTemplate
     {
         $CNF = &$this->_oConfig->CNF;
 
+        $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
+
+        $isPublic = CHECK_ACTION_RESULT_ALLOWED === $this->getModule()->checkAllowedView($aData) || $oPrivacy->isPartiallyVisible($aData[$CNF['FIELD_ALLOW_VIEW_TO']]);
+
+        //$aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
+
+        $oConn = isset($CNF['OBJECT_CONNECTIONS']) ? BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']) : null;
+
+        $oProfile = BxDolProfile::getInstanceByContentAndType($aData[$CNF['FIELD_ID']], $this->MODULE);
+        
         // get profile's url
         $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]);
 
         // generate html
-        return array (
+        $aVars = array (
             'id' => $aData[$CNF['FIELD_ID']],
-            'thumb_url' => $this->thumb ($aData),
-            'content_url' => $sUrl,
+            'thumb_url' => $isPublic ? $this->thumb ($aData) : $this->getImageUrl('no-picture-thumb.png'),
+            'cover_url' => CHECK_ACTION_RESULT_ALLOWED === $this->getModule()->checkAllowedViewCoverImage($aData) ? $this->urlCover ($aData, true) : $this->getImageUrl('cover.jpg'),
+            'content_url' => $isPublic ? $sUrl : 'javascript:void(0);',
             'title' => bx_process_output($aData[$CNF['FIELD_NAME']]),
             'module_name' => _t($CNF['T']['txt_sample_single']),
             'ts' => $aData[$CNF['FIELD_ADDED']],
+            'bx_if:info' => array(
+                'condition' => false,
+                'content' => array (
+                    'members' => '',
+                    'bx_if:btn' => array (
+                        'condition' => false,
+                        'content' => array (),
+                    ),
+                ),
+            ),
         );
+
+        return $aVars;
     }
 
     /**

+ 51 - 0
modules/base/profile/template/css/main.css

@@ -14,6 +14,57 @@
     width:8.5rem;
 }
 
+/* browse unit with cover */
+
+.bx-base-pofile-unit-cover {
+    display:block;
+
+    height:7.5rem;
+
+    line-height:7.5rem;
+    text-align:center;
+
+    background-repeat:no-repeat;
+    background-position:center center;
+    -webkit-background-size:cover;
+    -moz-background-size:cover;
+    -o-background-size:cover;
+    background-size:cover;
+}
+
+.bx-base-pofile-unit-cover img {
+    background-color:#fff;
+    vertical-align:middle;
+}
+
+.bx-base-pofile-cover,
+.bx-base-pofile-unit-info,
+.bx-base-pofile-unit-title {
+    width:17.5rem;
+}
+
+.bx-base-pofile-unit-with-cover {
+    display:inline-block;
+    overflow:hidden;
+}
+
+.bx-base-pofile-unit-title {
+    text-align:center;
+    white-space:nowrap;
+    text-overflow:ellipsis;
+    overflow:hidden;
+}
+
+.bx-base-pofile-unit-info-members {
+    float:left;
+    line-height:1.5rem;
+    vertical-align:middle;
+}
+
+.bx-base-pofile-unit-info-btn {
+    float:right;
+}
+
 /* profile cover */
 
 .bx-base-pofile-menu {

+ 16 - 0
modules/base/profile/template/unit_with_cover.html

@@ -0,0 +1,16 @@
+<div class="bx-base-pofile-unit-with-cover bx-def-border bx-def-margin-sec bx-def-round-corners bx-def-box bx-def-color-bg-box">
+    <a class="bx-base-pofile-unit-cover" style="background-image:url(__cover_url__);" href="__content_url__">
+        <img class="bx-def-thumb bx-def-thumb-size bx-def-border" src="__thumb_url__" />
+    </a>
+    <div class="bx-base-pofile-unit-title bx-def-margin-sec-topbottom"><a href="__content_url__">__title__</a></div>
+    <bx_if:info>
+    <div class="bx-base-pofile-unit-info bx-def-box-sizing bx-def-padding-sec-rightbottomleft bx-clearfix">
+        <div class="bx-base-pofile-unit-info-members bx-def-font-grayed bx-def-font-small">__members__</div>
+        <div class="bx-base-pofile-unit-info-btn">
+            <bx_if:btn>
+                <button class="bx-btn bx-btn-small" onclick="bx_conn_action(this, '__object__', 'add', '__id__')">__title__</button>
+            </bx_if:btn>
+        </div>
+    </div>
+    </bx_if:info>
+</div>

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

@@ -24,10 +24,10 @@ class BxGroupsAlertsResponse extends BxBaseModProfileAlertsResponse
         $CNF = $this->_oModule->_oConfig->CNF;
 
         // connection events
-        if ('bx_groups_fans' == $oAlert->sUnit && 'connection_added' == $oAlert->sAction) {
+        if ($CNF['OBJECT_CONNECTIONS'] == $oAlert->sUnit && 'connection_added' == $oAlert->sAction) {
             $this->_oModule->serviceAddMutualConnection($oAlert->aExtras['content'], $oAlert->aExtras['initiator']);
         }
-        elseif ('bx_groups_fans' == $oAlert->sUnit && 'connection_removed' == $oAlert->sAction) {
+        elseif ($CNF['OBJECT_CONNECTIONS'] == $oAlert->sUnit && 'connection_removed' == $oAlert->sAction) {
             $this->_oModule->serviceOnRemoveConnection($oAlert->aExtras['content'], $oAlert->aExtras['initiator']);
         }
 
@@ -37,7 +37,7 @@ class BxGroupsAlertsResponse extends BxBaseModProfileAlertsResponse
             $this->_oModule->serviceReassignEntitiesByAuthor($oAlert->iObject);
         }
 
-        if ('bx_groups' != $oAlert->sUnit)
+        if ($this->MODULE != $oAlert->sUnit)
             return;
 
         // join group events
@@ -56,7 +56,7 @@ class BxGroupsAlertsResponse extends BxBaseModProfileAlertsResponse
 
     protected function sendMailInvitation ($oAlert, $iProfileId, $iSender = 0)
     {
-        sendMailTemplate('bx_groups_invitation', 0, $iProfileId, array(
+        sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_INVITATION'], 0, $iProfileId, array(
             'InviterUrl' => BxDolProfile::getInstance($iSender)->getUrl(),
             'InviterDisplayName' => BxDolProfile::getInstance($iSender)->getDisplayName(),
             'EntryUrl' => $oAlert->aExtras['entry_url'],
@@ -68,7 +68,7 @@ class BxGroupsAlertsResponse extends BxBaseModProfileAlertsResponse
     {
         $aAdmins = $this->_oModule->_oDb->getAdmins($oAlert->aExtras['group_profile']);
         foreach ($aAdmins as $iAdminProfileId) {
-            sendMailTemplate('bx_groups_join_request', 0, $iAdminProfileId, array(
+            sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_JOIN_REQUEST'], 0, $iAdminProfileId, array(
                 'NewMemberUrl' => BxDolProfile::getInstance($iProfileId)->getUrl(),
                 'NewMemberDisplayName' => BxDolProfile::getInstance($iProfileId)->getDisplayName(),
                 'EntryUrl' => $oAlert->aExtras['entry_url'],
@@ -79,7 +79,7 @@ class BxGroupsAlertsResponse extends BxBaseModProfileAlertsResponse
 
     protected function sendMailJoinRequestAccepted ($oAlert, $iProfileId, $iSender = 0)
     {
-        sendMailTemplate('bx_groups_join_confirm', 0, $iProfileId, array(
+        sendMailTemplate($this->_oModule->_oConfig->CNF['EMAIL_JOIN_CONFIRM'], 0, $iProfileId, array(
             'EntryUrl' => $oAlert->aExtras['entry_url'],
             'EntryTitle' => $oAlert->aExtras['entry_title'],
         ), BX_EMAIL_NOTIFY);

+ 21 - 1
modules/boonex/groups/classes/BxGroupsConfig.php

@@ -96,11 +96,20 @@ class BxGroupsConfig extends BxBaseModProfileConfig
             'OBJECT_PAGE_VIEW_ENTRY' => 'bx_groups_view_profile',
             'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_groups_view_profile_closed',
             'OBJECT_PRIVACY_VIEW' => 'bx_groups_allow_view_to',
+            'OBJECT_PRIVACY_VIEW_NOTIFICATION_EVENT' => 'bx_groups_allow_view_notification_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_groups_administration',
         	'OBJECT_GRID_COMMON' => 'bx_groups_common',
             'OBJECT_GRID_CONNECTIONS' => 'bx_groups_fans',
             'OBJECT_CONNECTIONS' => 'bx_groups_fans',
 
+            'EMAIL_INVITATION' => 'bx_groups_invitation',
+            'EMAIL_JOIN_REQUEST' => 'bx_groups_join_request',
+            'EMAIL_JOIN_CONFIRM' => 'bx_groups_join_confirm',
+            'EMAIL_FAN_BECOME_ADMIN' => 'bx_groups_fan_become_admin',
+            'EMAIL_ADMIN_BECOME_FAN' => 'bx_groups_admin_become_fan',
+            'EMAIL_FAN_REMOVE' => 'bx_groups_fan_remove',
+            'EMAIL_JOIN_REJECT' => 'bx_groups_join_reject',
+
             'TRIGGER_MENU_PROFILE_VIEW_SUBMENU' => 'trigger_group_view_submenu',
             'TRIGGER_MENU_PROFILE_VIEW_ACTIONS' => 'trigger_group_view_actions',
         	'TRIGGER_PAGE_VIEW_ENTRY' => 'trigger_page_profile_view_entry',
@@ -126,6 +135,10 @@ class BxGroupsConfig extends BxBaseModProfileConfig
             'T' => array (
                 'txt_sample_single' => '_bx_groups_txt_sample_single',
                 'txt_sample_vote_single' => '_bx_groups_txt_sample_vote_single',
+                'txt_private_group' => '_bx_groups_txt_private_group',
+                'txt_N_fans' => '_bx_groups_txt_N_fans',
+                'txt_ntfs_join_request' => '_bx_groups_txt_ntfs_join_request',
+                'txt_ntfs_fan_added' => '_bx_groups_txt_ntfs_fan_added',
                 'menu_item_title_befriend_sent' => '_bx_groups_menu_item_title_befriend_sent',
                 'menu_item_title_unfriend_cancel_request' => '_bx_groups_menu_item_title_unfriend_cancel_request',
                 'menu_item_title_befriend_confirm' => '_bx_groups_menu_item_title_befriend_confirm',
@@ -139,7 +152,14 @@ class BxGroupsConfig extends BxBaseModProfileConfig
             	'filter_item_suspended' => '_bx_groups_grid_filter_item_title_adm_suspended',
             	'filter_item_select_one_filter1' => '_bx_groups_grid_filter_item_title_adm_select_one_filter1',
             	'menu_item_manage_my' => '_bx_groups_menu_item_title_manage_my',
-            	'menu_item_manage_all' => '_bx_groups_menu_item_title_manage_all',
+                'menu_item_manage_all' => '_bx_groups_menu_item_title_manage_all',
+                'menu_item_title_become_fan_sent' => '_bx_groups_menu_item_title_become_fan_sent',
+                'menu_item_title_leave_group_cancel_request' => '_bx_groups_menu_item_title_leave_group_cancel_request',
+                'menu_item_title_become_fan' => '_bx_groups_menu_item_title_become_fan',
+                'menu_item_title_leave_group' => '_bx_groups_menu_item_title_leave_group',
+                
+                'menu_item_title_become_fan_sent' => '_bx_groups_menu_item_title_become_fan_sent',
+                'menu_item_title_become_fan' => '_bx_groups_menu_item_title_become_fan',
             ),
 
         );

+ 2 - 2
modules/boonex/groups/classes/BxGroupsDb.php

@@ -23,10 +23,10 @@ class BxGroupsDb extends BxBaseModProfileDb
     {
         $CNF = &$this->_oConfig->CNF;
 
-        $sQuery = "UPDATE `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` SET `" . $CNF['FIELD_AUTHOR'] . "` = :" . $CNF['FIELD_AUTHOR'] . " WHERE `id` = :id";
+        $sQuery = "UPDATE `" . $this->_oConfig->CNF['TABLE_ENTRIES'] . "` SET `" . $CNF['FIELD_AUTHOR'] . "` = :author WHERE `" . $CNF['FIELD_ID'] . "` = :id";
         return $this->query($sQuery, array(
     		'id' => $iContentId,
-    		$CNF['FIELD_AUTHOR'] => $iProfileId,
+    		'author' => $iProfileId,
     	));
     }
 

+ 1 - 1
modules/boonex/groups/classes/BxGroupsFormEntry.php

@@ -28,7 +28,7 @@ class BxGroupsFormEntry extends BxBaseModProfileFormEntry
 
     protected function genCustomInputInitialMembers ($aInput)
     {
-        $aInput['ajax_get_suggestions'] = BX_DOL_URL_ROOT . "modules/?r=groups/ajax_get_initial_members";
+        $aInput['ajax_get_suggestions'] = BX_DOL_URL_ROOT . "modules/?r=" . $this->_oModule->_oConfig->getUri() . "/ajax_get_initial_members";
         return $this->genCustomInputUsernamesSuggestions($aInput);
     }
 }

+ 1 - 1
modules/boonex/groups/classes/BxGroupsGridCommon.php

@@ -3,7 +3,7 @@
  * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  *
- * @defgroup    Posts Posts
+ * @defgroup    Groups Groups
  * @ingroup     TridentModules
  * 
  * @{

+ 2 - 2
modules/boonex/groups/classes/BxGroupsGridConnections.php

@@ -128,7 +128,7 @@ class BxGroupsGridConnections extends BxDolGridConnections
         } 
         else {
 
-            $sEmailTemplate = 'toAdmins' == $sFunc ? 'bx_groups_fan_become_admin' : 'bx_groups_admin_become_fan';
+            $sEmailTemplate = 'toAdmins' == $sFunc ? $this->_oModule->_oConfig->CNF['EMAIL_FAN_BECOME_ADMIN'] : $this->_oModule->_oConfig->CNF['EMAIL_ADMIN_BECOME_FAN'];
             list($iGroupProfileId, $iProfileId) = $this->_prepareGroupProfileAndMemberProfile($iGroupProfileId, $iId);
             if (bx_get_logged_profile_id() != $iProfileId) {
                 // notify about admin status
@@ -151,7 +151,7 @@ class BxGroupsGridConnections extends BxDolGridConnections
         list ($iId, $iViewedId) = $this->_prepareIds();
 
         // send email notification
-        $sEmailTemplate = $this->_oConnection->isConnected($iViewedId, $iId, true) ? 'bx_groups_fan_remove' : 'bx_groups_join_reject';
+        $sEmailTemplate = $this->_oConnection->isConnected($iViewedId, $iId, true) ? $this->_oModule->_oConfig->CNF['EMAIL_FAN_REMOVE'] : $this->_oModule->_oConfig->CNF['EMAIL_JOIN_REJECT'];
         list($iGroupProfileId, $iProfileId) = $this->_prepareGroupProfileAndMemberProfile($iId, $iViewedId);
         if (bx_get_logged_profile_id() != $iProfileId) {
             sendMailTemplate($sEmailTemplate, 0, $iProfileId, array(

+ 7 - 7
modules/boonex/groups/classes/BxGroupsMenuView.php

@@ -21,21 +21,21 @@ class BxGroupsMenuView extends BxBaseModProfileMenuView
         parent::__construct($aObject, $oTemplate);
 
         if ($this->_oProfile && isLogged()) {
-
-            $oConn = BxDolConnection::getObjectInstance($this->_oModule->_oConfig->CNF['OBJECT_CONNECTIONS']);
+            $CNF = &$this->_oModule->_oConfig->CNF;
+            
+            $oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']);
             if ($oConn && $oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $this->_oProfile->id())) {
                 $this->addMarkers(array(
-                    'title_add_fan' => _t('_bx_groups_menu_item_title_become_fan_sent'),
-                    'title_remove_fan' => _t('_bx_groups_menu_item_title_leave_group_cancel_request'),
+                    'title_add_fan' => _t($CNF['T']['menu_item_title_become_fan_sent']),
+                    'title_remove_fan' => _t($CNF['T']['menu_item_title_leave_group_cancel_request']),
                 ));
             } else {
                 $this->addMarkers(array(
-                    'title_add_fan' => _t('_bx_groups_menu_item_title_become_fan'),
-                    'title_remove_fan' => _t('_bx_groups_menu_item_title_leave_group'),
+                    'title_add_fan' => _t($CNF['T']['menu_item_title_become_fan']),
+                    'title_remove_fan' => _t($CNF['T']['menu_item_title_leave_group']),
                 ));
             }
 
-            $CNF = $this->_oModule->_oConfig->CNF;
             if ($oConn && $this->_oModule->isFan($this->_aContentInfo[$CNF['FIELD_ID']])) {
                 $a = $oConn->getConnectedInitiators($this->_oProfile->id());
                 $this->addMarkers(array('recipients' => implode(',', $a)));

+ 10 - 8
modules/boonex/groups/classes/BxGroupsModule.php

@@ -90,8 +90,10 @@ class BxGroupsModule extends BxBaseModProfileModule
 
     public function servicePrepareFields ($aFieldsProfile)
     {
-        $aFieldsProfile['group_name'] = $aFieldsProfile['name'];
-        $aFieldsProfile['group_desc'] = isset($aFieldsProfile['description']) ? $aFieldsProfile['description'] : '';
+        $CNF = &$this->_oConfig->CNF;
+        
+        $aFieldsProfile[$CNF['FIELD_NAME']] = $aFieldsProfile['name'];
+        $aFieldsProfile[$CNF['FIELD_TEXT']] = isset($aFieldsProfile['description']) ? $aFieldsProfile['description'] : '';
         unset($aFieldsProfile['name']);
         unset($aFieldsProfile['description']);
         return $aFieldsProfile;
@@ -130,19 +132,19 @@ class BxGroupsModule extends BxBaseModProfileModule
         $sEntryTitle = $aContentInfo[$CNF['FIELD_NAME']];
         $sEntryUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
 
-        // send invitation to the group (@see BxGroupsAlertsResponse)
+        // send invitation to the group 
         if ($iIgnoreJoinConfirmation && !$oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id()) && !$oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId) && bx_get_logged_profile_id() != $iProfileId) {
 
             bx_alert($this->getName(), 'join_invitation', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
 
         }
-        // send notification to group's admins that new connection is pending confirmation (@see BxGroupsAlertsResponse)
+        // send notification to group's admins that new connection is pending confirmation 
         elseif (!$iIgnoreJoinConfirmation && $oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id()) && !$oConnection->isConnected($oGroupProfile->id(), (int)$iInitiatorId) && $aContentInfo['join_confirmation']) {
 
             bx_alert($this->getName(), 'join_request', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
 
         }
-        // send notification that join request was accepted (@see BxGroupsAlertsResponse)
+        // send notification that join request was accepted 
         else if (!$iIgnoreJoinConfirmation && $oConnection->isConnected((int)$iInitiatorId, $oGroupProfile->id(), true) && $oGroupProfile->getModule() != $this->getName() && bx_get_logged_profile_id() != $iProfileId) {
             
             bx_alert($this->getName(), 'join_request_accepted', $aContentInfo[$CNF['FIELD_ID']], $iGroupProfileId, array('content' => $aContentInfo, 'entry_title' => $sEntryTitle, 'entry_url' => $sEntryUrl, 'group_profile' => $iGroupProfileId, 'profile' => $iProfileId, 'notification_subobject_id' => $iProfileId, 'object_author_id' => $aContentInfo[$CNF['FIELD_AUTHOR']]));
@@ -244,7 +246,7 @@ class BxGroupsModule extends BxBaseModProfileModule
 
                 array('group' => $sModule . '_fan_added', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'fan_added', 'module_name' => $sModule, 'module_method' => 'get_notifications_fan_added', 'module_class' => 'Module'),
 
-                array('group' => $sModule . '_join_request', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'join_request', 'module_name' => $sModule, 'module_method' => 'get_notifications_join_request', 'module_class' => 'Module', 'module_event_privacy' => 'bx_groups_allow_view_notification_to'),
+                array('group' => $sModule . '_join_request', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'join_request', 'module_name' => $sModule, 'module_method' => 'get_notifications_join_request', 'module_class' => 'Module', 'module_event_privacy' => $this->_oConfig->CNF['OBJECT_PRIVACY_VIEW_NOTIFICATION_EVENT']),
                 
                 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'),
             ),
@@ -263,7 +265,7 @@ class BxGroupsModule extends BxBaseModProfileModule
      */
     public function serviceGetNotificationsJoinRequest($aEvent)
     {
-        return $this->_serviceGetNotification($aEvent, '_bx_groups_txt_ntfs_join_request');
+        return $this->_serviceGetNotification($aEvent, $this->_oConfig->CNF['T']['txt_ntfs_join_request']);
     }
     
 	/**
@@ -271,7 +273,7 @@ class BxGroupsModule extends BxBaseModProfileModule
      */
     public function serviceGetNotificationsFanAdded($aEvent)
     {
-        return $this->_serviceGetNotification($aEvent, '_bx_groups_txt_ntfs_fan_added');
+        return $this->_serviceGetNotification($aEvent, $this->_oConfig->CNF['T']['txt_ntfs_fan_added']);
     }
 
     /**

+ 2 - 13
modules/boonex/groups/classes/BxGroupsPrivacy.php

@@ -11,11 +11,10 @@
 
 class BxGroupsPrivacy extends BxBaseModProfilePrivacy
 {
-    protected $_aPrivacyParticallyVisible = array ('c', 5);
-
     public function __construct($aOptions, $oTemplate = false)
     {
-    	$this->MODULE = 'bx_groups';
+        $this->MODULE = 'bx_groups';
+        $this->_aPrivacyParticallyVisible = array ('c', 5);
         parent::__construct($aOptions, $oTemplate);
     }
 
@@ -52,16 +51,6 @@ class BxGroupsPrivacy extends BxBaseModProfilePrivacy
         return $this->isClosedGroupAccess($iObjectOwnerId, $iViewerId, $iObjectId);
     }
 
-    public function isPartiallyVisible ($mixedPrivacy)
-    {
-        return in_array($mixedPrivacy, $this->_aPrivacyParticallyVisible);
-    }
-
-    public function getPartiallyVisiblePrivacyGroups ()
-    {
-        return $this->_aPrivacyParticallyVisible;
-    }
-
     static function getGroupChooser ($sObject, $iOwnerId = 0, $aParams = array())
     {
         if (!$iOwnerId)

+ 8 - 13
modules/boonex/groups/classes/BxGroupsTemplate.php

@@ -22,30 +22,25 @@ class BxGroupsTemplate extends BxBaseModProfileTemplate
 
     function unitVars ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
     {
+        $aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
+        
         $CNF = &$this->_oConfig->CNF;
 
         $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
 
-        $isPublic = CHECK_ACTION_RESULT_ALLOWED === $this->getModule()->checkAllowedView($aData) || $oPrivacy->isPartiallyVisible($aData[$CNF['FIELD_ALLOW_VIEW_TO']]);
-
-        $aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
-
+        $isPublic = CHECK_ACTION_RESULT_ALLOWED === $this->getModule()->checkAllowedView($aData) || $oPrivacy->isPartiallyVisible($aData[$CNF['FIELD_ALLOW_VIEW_TO']]);        
         $oConn = BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS']);
 
         $oGroupProfile = BxDolProfile::getInstanceByContentAndType($aData[$CNF['FIELD_ID']], $this->MODULE);
 
-        if (!$isPublic) {
-            $aVars['thumb_url'] = $this->getImageUrl('no-picture-thumb.png');
-            $aVars['content_url'] = 'javascript:void(0);';
-            $aVars['title'] = _t('_bx_groups_txt_private_group');
-        }
-        $aVars['cover_url'] = CHECK_ACTION_RESULT_ALLOWED === $this->getModule()->checkAllowedViewCoverImage($aData) ? $this->urlCover ($aData, true) : $this->getImageUrl('cover.jpg');
-        $aVars['members'] = $isPublic ? _t('_bx_groups_txt_N_fans', $oConn ? $oConn->getConnectedInitiatorsCount($oGroupProfile->id(), true) : 0) : '&nbsp;';
-        $aVars['bx_if:btn'] = array (
+        $aVars['title'] = $isPublic ? bx_process_output($aData[$CNF['FIELD_NAME']]) : _t($CNF['T']['txt_private_group']);
+        $aVars['bx_if:info']['condition'] = true;
+        $aVars['bx_if:info']['content']['members'] = $isPublic ? _t($CNF['T']['txt_N_fans'], $oConn ? $oConn->getConnectedInitiatorsCount($oGroupProfile->id(), true) : 0) : '&nbsp;';
+        $aVars['bx_if:info']['content']['bx_if:btn'] = array (
             'condition' => isLogged() && $isPublic && !$oConn->isConnected(bx_get_logged_profile_id(), $oGroupProfile->id(), true),
             'content' => array (
                 'id' => $oGroupProfile->id(),
-                'title' => $oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $oGroupProfile->id()) ? _t('_bx_groups_menu_item_title_become_fan_sent') : _t('_bx_groups_menu_item_title_become_fan'),
+                'title' => $oConn->isConnectedNotMutual(bx_get_logged_profile_id(), $oGroupProfile->id()) ? _t($CNF['T']['menu_item_title_become_fan_sent']) : _t($CNF['T']['menu_item_title_become_fan']),
                 'object' => $CNF['OBJECT_CONNECTIONS'],
             ),
         );

+ 7 - 7
modules/boonex/groups/js/manage_tools.js

@@ -2,16 +2,16 @@
  * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  *
- * @defgroup    Organizations Organizations
+ * @defgroup    Groups Groups
  * @ingroup     TridentModules
  *
  * @{
  */
 
-function BxOrgsManageTools(oOptions) {
+function BxGroupsManageTools(oOptions) {
 	this._sActionsUrl = oOptions.sActionUrl;
 	this._sObjNameGrid = oOptions.sObjNameGrid;
-    this._sObjName = oOptions.sObjName == undefined ? 'oBxOrgsManageTools' : oOptions.sObjName;
+    this._sObjName = oOptions.sObjName == undefined ? 'oBxGroupsManageTools' : oOptions.sObjName;
 
     this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
     this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
@@ -21,7 +21,7 @@ function BxOrgsManageTools(oOptions) {
     this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
 }
 
-BxOrgsManageTools.prototype.onChangeFilter = function(oFilter) {
+BxGroupsManageTools.prototype.onChangeFilter = function(oFilter) {
 	var oFilter1 = $('#bx-grid-filter1-' + this._sObjNameGrid);
 	var sValueFilter1 = oFilter1.length > 0 ? oFilter1.val() : '';
 
@@ -33,7 +33,7 @@ BxOrgsManageTools.prototype.onChangeFilter = function(oFilter) {
 	glGrids[this._sObjNameGrid].setFilter(sValueFilter1 + this._sParamsDivider + sValueSearch, true);
 };
 
-BxOrgsManageTools.prototype.onClickSettings = function(sMenuObject, oButton) {
+BxGroupsManageTools.prototype.onClickSettings = function(sMenuObject, oButton) {
 	if($(oButton).hasClass('bx-btn-disabled'))
 		return false;
 
@@ -42,13 +42,13 @@ BxOrgsManageTools.prototype.onClickSettings = function(sMenuObject, oButton) {
 	});
 };
 
-BxOrgsManageTools.prototype.onClickDelete = function(iContentId) {
+BxGroupsManageTools.prototype.onClickDelete = function(iContentId) {
 	$('.bx-popup-applied:visible').dolPopupHide();
 
 	glGrids[this._sObjNameGrid].actionWithId(iContentId, 'delete', {}, '', false, 1);
 };
 
-BxOrgsManageTools.prototype.onClickDeleteWithContent = function(iContentId) {
+BxGroupsManageTools.prototype.onClickDeleteWithContent = function(iContentId) {
 	$('.bx-popup-applied:visible').dolPopupHide();
 
 	glGrids[this._sObjNameGrid].actionWithId(iContentId, 'delete_with_content', {}, '', false, 1);

+ 6 - 47
modules/boonex/groups/template/css/main.css

@@ -7,54 +7,13 @@
     -webkit-border-radius:0.1875rem;
 }
 
-.bx-search-result-block {
-    text-align:center;
-}
-
-.bx-groups-unit {
-    display:inline-block;
-    overflow:hidden;
-}
-
-.bx-groups-cover {
-    display:block;
-
-    height:7.5rem;
-
-    line-height:7.5rem;
-    text-align:center;
-
-    background-repeat:no-repeat;
-    background-position:center center;
-    -webkit-background-size:cover;
-    -moz-background-size:cover;
-    -o-background-size:cover;
-    background-size:cover;
-}
-
-.bx-groups-cover,
-.bx-groups-unit-info {
-    width:17.5rem;
-}
-
-.bx-groups-cover img {
-    background-color:#fff;
-    vertical-align:middle;
+.bx-groups-unit-cover .bx-base-pofile-unit-cover .bx-def-thumb {
+    border-width:0.0625rem;
+    border-radius:0.1875rem;
+    -moz-border-radius:0.1875rem;
+    -webkit-border-radius:0.1875rem;
 }
 
-.bx-groups-unit-title {
+.bx-search-result-block {
     text-align:center;
-    white-space:nowrap;
-    text-overflow:ellipsis;
-    overflow:hidden;    
-}
-
-.bx-groups-unit-info-members {
-    float:left;
-    line-height:1.5rem;
-    vertical-align:middle;
-}
-
-.bx-groups-unit-info-btn {
-    float:right;
 }

+ 2 - 14
modules/boonex/groups/template/unit.html

@@ -1,14 +1,2 @@
-<div class="bx-groups-unit bx-def-border bx-def-margin-sec bx-def-round-corners bx-def-box bx-def-color-bg-box">
-    <a class="bx-groups-cover" style="background-image:url(__cover_url__);" href="__content_url__">
-        <img class="bx-def-thumb-size bx-def-border bx-def-round-corners" src="__thumb_url__" />
-    </a>
-    <div class="bx-groups-unit-title bx-def-margin-sec-top"><a href="__content_url__">__title__</a></div>
-    <div class="bx-groups-unit-info bx-def-box-sizing bx-def-padding-sec bx-clearfix">
-        <div class="bx-groups-unit-info-members bx-def-font-grayed bx-def-font-small">__members__</div>
-        <div class="bx-groups-unit-info-btn">
-            <bx_if:btn>
-                <button class="bx-btn bx-btn-small" onclick="bx_conn_action(this, '__object__', 'add', '__id__')">__title__</button>
-            </bx_if:btn>
-        </div>
-    </div>
-</div>
+<span class="bx-groups-unit-cover"><bx_include_base:../modules/base/profile/template/unit_with_cover.html /></span>
+

+ 2 - 2
modules/boonex/organizations/classes/BxOrgsPrivacy.php

@@ -9,11 +9,11 @@
  * @{
  */
 
-class BxBaseModProfilePrivacy extends BxTemplPrivacy
+class BxOrgsPrivacy extends BxBaseModProfilePrivacy
 {
     function __construct($aOptions, $oTemplate = false)
     {
-    	$this->MODULE = 'bx_orgs';
+    	$this->MODULE = 'bx_organizations';
         parent::__construct($aOptions, $oTemplate);
     }
 }

+ 4 - 2
modules/boonex/organizations/classes/BxOrgsSearchResult.php

@@ -15,6 +15,8 @@ class BxOrgsSearchResult extends BxBaseModProfileSearchResult
     {
         parent::__construct($sMode, $aParams);
 
+        $this->sUnitTemplate = 'unit_with_cover.html';
+
         $this->aCurrent =  array(
             'name' => 'bx_organizations',
             'module_name' => 'bx_organizations',
@@ -37,7 +39,7 @@ class BxOrgsSearchResult extends BxBaseModProfileSearchResult
                     'table' => 'bx_organizations_data',
                     'mainField' => 'content_id',
                     'onField' => 'id',
-                    'joinFields' => array('id', 'org_name', 'picture', 'added', 'author', 'allow_view_to'),
+                    'joinFields' => array('id', 'org_name', 'picture', 'cover', 'added', 'author', 'allow_view_to'),
                 ),
                 'account' => array(
                     'type' => 'INNER',
@@ -126,7 +128,7 @@ class BxOrgsSearchResult extends BxBaseModProfileSearchResult
                 $this->isError = true;
         }
 
-        parent::__construct();
+        $this->sCenterContentUnitSelector = false;
     }
 
     function getAlterOrder()

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

@@ -367,5 +367,5 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 -- PRIVACY 
 
 INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
-('bx_organizations_allow_view_to', 'bx_organizations', 'view', '_bx_orgs_form_profile_input_allow_view_to', '3', 'bx_organizations_data', 'id', 'author', '', '');
+('bx_organizations_allow_view_to', 'bx_organizations', 'view', '_bx_orgs_form_profile_input_allow_view_to', '3', 'bx_organizations_data', 'id', 'author', 'BxOrgsPrivacy', 'modules/boonex/organizations/classes/BxOrgsPrivacy.php');
 

+ 1 - 0
modules/boonex/organizations/template/unit_with_cover.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/unit_with_cover.html />

+ 2 - 2
modules/boonex/persons/classes/BxPersonsPrivacy.php

@@ -3,13 +3,13 @@
  * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  *
- * @defgroup    Organizations Organizations
+ * @defgroup    Persons Persons
  * @ingroup     TridentModules
  *
  * @{
  */
 
-class BxPersonsPrivacy extends BxTemplPrivacy
+class BxPersonsPrivacy extends BxBaseModProfilePrivacy
 {
     function __construct($aOptions, $oTemplate = false)
     {

+ 4 - 2
modules/boonex/persons/classes/BxPersonsSearchResult.php

@@ -15,6 +15,8 @@ class BxPersonsSearchResult extends BxBaseModProfileSearchResult
     {
         parent::__construct($sMode, $aParams);
 
+        $this->sUnitTemplate = 'unit_with_cover.html';
+
         $this->aCurrent =  array(
             'name' => 'bx_persons',
             'module_name' => 'bx_persons',
@@ -37,7 +39,7 @@ class BxPersonsSearchResult extends BxBaseModProfileSearchResult
                     'table' => 'bx_persons_data',
                     'mainField' => 'content_id',
                     'onField' => 'id',
-                    'joinFields' => array('id', 'fullname', 'picture', 'added', 'author', 'allow_view_to'),
+                    'joinFields' => array('id', 'fullname', 'picture', 'cover', 'added', 'author', 'allow_view_to'),
                 ),
                 'account' => array(
                     'type' => 'INNER',
@@ -126,7 +128,7 @@ class BxPersonsSearchResult extends BxBaseModProfileSearchResult
                 $this->isError = true;
         }
 
-        parent::__construct();
+        $this->sCenterContentUnitSelector = false;
     }
 
     function getAlterOrder()

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

@@ -358,5 +358,5 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 -- PRIVACY 
 
 INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
-('bx_persons_allow_view_to', 'bx_persons', 'view', '_bx_persons_form_profile_input_allow_view_to', '3', 'bx_persons_data', 'id', 'author', '', '');
+('bx_persons_allow_view_to', 'bx_persons', 'view', '_bx_persons_form_profile_input_allow_view_to', '3', 'bx_persons_data', 'id', 'author', 'BxPersonsPrivacy', 'modules/boonex/persons/classes/BxPersonsPrivacy.php');
 

+ 1 - 0
modules/boonex/persons/template/unit_with_cover.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/unit_with_cover.html />