Bläddra i källkod

#25 - notes menu in profile + related improvements and fixes

Alex Trofimov 13 år sedan
förälder
incheckning
8a4ba8037c

+ 1 - 1
inc/classes/BxDolDb.php

@@ -632,7 +632,7 @@ EOJ;
         if (is_array($mixed)) {
             $s = '';
             foreach ($mixed as $v)
-                $s .= is_numeric($v) ? $v : "'" . mysql_real_escape_string($v) . "',";
+                $s .= (is_numeric($v) ? $v : "'" . mysql_real_escape_string($v) . "'") . ',';
             if ($s)
                 return substr($s, 0, -1);
             else

+ 11 - 2
inc/classes/BxDolPrivacy.php

@@ -198,8 +198,17 @@ class BxDolPrivacy extends BxDol implements iBxDolFactoryObject
      * @param $sAction action to be checked
      * @return array of conditions, for now with 'restriction' part only is returned
      */
-    public function getContentPublicAsCondition($sAction) {
-        return $this->getContentByGroupAsCondition($sAction, isLogged() ? array(BX_DOL_PG_ALL, BX_DOL_PG_MEMBERS) : BX_DOL_PG_ALL);
+    public function getContentPublicAsCondition($sAction, $iProfileIdOwner = 0) {
+        $mixedPrivacyGroups = BX_DOL_PG_ALL;
+        if (isLogged()) {
+            if (bx_get_logged_profile_id() == $iProfileIdOwner)
+                return array();
+            if ($iProfileIdOwner && $this->checkConnections($iProfileIdOwner, bx_get_logged_profile_id()))
+                $mixedPrivacyGroups = array(BX_DOL_PG_ALL, BX_DOL_PG_MEMBERS, BX_DOL_PG_CONNECTIONS);
+            else
+                $mixedPrivacyGroups = array(BX_DOL_PG_ALL, BX_DOL_PG_MEMBERS);
+        }
+        return $this->getContentByGroupAsCondition($sAction, $mixedPrivacyGroups);
     }
 
     /**

+ 34 - 0
inc/classes/BxDolSearch.php

@@ -216,6 +216,8 @@ class BxDolSearchResult {
 
     var $bProcessPrivateContent = true;
 
+    protected $_aMarkers = array ();
+
     /**
      * constructor
      * filling identificator field
@@ -724,5 +726,37 @@ class BxDolSearchResult {
     function _getPseud () {
 
     }
+
+    /**
+     * Add replace markers. Markers are replaced in titles and browse urls
+     * @param $a array of markers as key => value
+     * @return true on success or false on error
+     */
+    public function addMarkers ($a) {
+        if (empty($a) || !is_array($a))
+            return false;
+        $this->_aMarkers = array_merge ($this->_aMarkers, $a);
+        return true;
+    }
+
+    /**
+     * Replace provided markers in a string
+     * @param $mixed string or array to replace markers in
+     * @return string where all occured markers are replaced
+     */ 
+    protected function _replaceMarkers ($mixed) {
+        if (empty($this->_aMarkers))
+            return $mixed;
+
+        if (is_array($mixed)) {
+            foreach ($mixed as $sKey => $sValue)
+                $mixed[$sKey] = $this->_replaceMarkers ($sValue);
+        } else {
+            foreach ($this->_aMarkers as $sKey => $sValue)
+                $mixed = str_replace('{' . $sKey . '}', $sValue, $mixed);
+        }
+
+        return $mixed;
+    }
 }
 

+ 1 - 1
modules/boonex/notes/classes/BxNotesMenuViewNote.php → modules/boonex/notes/classes/BxNotesMenuView.php

@@ -14,7 +14,7 @@ bx_import('BxTemplMenu');
 /**
  * 'View Note' menu.
  */
-class BxNotesMenuViewNote extends BxTemplMenu {
+class BxNotesMenuView extends BxTemplMenu {
 
     protected $_aContentInfo;
     protected $_oModule;

+ 6 - 2
modules/boonex/notes/classes/BxNotesModule.php

@@ -34,8 +34,12 @@ class BxNotesModule extends BxDolModule {
         return $this->_serviceBrowse ('public');
     }
 
-    public function serviceBrowseMy () {
-        return $this->_serviceBrowse ('my');
+    public function serviceBrowseAuthor ($iProfileId = 0) {
+        if (!$iProfileId)
+            $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
+        if (!$iProfileId)
+            return '';
+        return $this->_serviceBrowse ('author', array('author' => $iProfileId));
     }
 
     public function _serviceBrowse ($sMode, $aParams = false) {

+ 37 - 38
modules/boonex/notes/classes/BxNotesSearchResult.php

@@ -41,8 +41,9 @@ class BxNotesSearchResult extends BxTemplSearchResult {
     );
 
 
-    function __construct($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '') {
+    function __construct($sMode = '', $aParams) {
 
+        $oProfileAuthor = null;
         $oModuleMain = $this->getMain();
 
         switch ($sMode) {
@@ -56,46 +57,23 @@ class BxNotesSearchResult extends BxTemplSearchResult {
                 unset($this->aCurrent['rss']);
                 break;
 
-            case 'user':
-                $iProfileId = (int)$sValue;                
-                $aContentInfo = $oModuleMain->_oDb->getContentInfoById($iContentId);
-                if (!$aContentInfo)
+            case 'author':
+                bx_import('BxDolProfile');                
+                $oProfileAuthor = BxDolProfile::getInstance((int)$aParams['author']);
+                if (!$oProfileAuthor) {
                     $this->isError = true;
-                else
-                    $this->aCurrent['restriction']['owner']['value'] = $iProfileId;
-
-                $this->sBrowseUrl = "browse/user/$sValue";
-                $this->aCurrent['title'] = _t('_bx_notes_page_title_browse_by_author', $aContentInfo['fullname']); // TODO: owner name here
-                if (bx_get('rss')) {
-                    $aData = getProfileInfo($iProfileId);
-                    if ($aData['Avatar']) {
-                        $a = array ('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']);
-                        $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search');
-                        if (!$aImage['no_image'])
-                            $this->aCurrent['rss']['image'] = $aImage['file'];
-                    }
+                    break;
                 }
-                break;
 
-            case 'my':
-                $this->sBrowseUrl = 'browse/my';
-                $this->aCurrent['restriction']['author']['value'] = bx_get_logged_profile_id();
-                $this->aCurrent['title'] = _t('_bx_notes_page_title_browse_my');
+                $this->aCurrent['restriction']['author']['value'] = $oProfileAuthor->id();
+
+                $this->sBrowseUrl = 'page.php?i=notes-author&profile_id={profile_id}';
+                $this->aCurrent['title'] = _t('_bx_notes_page_title_browse_by_author');               
                 break;
             
             case 'public':
             case '':
-                bx_import('BxDolPrivacy');
-                $oPrivacy = BxDolPrivacy::getObjectInstance(BxNotesConfig::$OBJECT_PRIVACY_VIEW);
-                $a = $oPrivacy ? $oPrivacy->getContentPublicAsCondition('view') : array();
-                if (isset($a['restriction']))
-                    $this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], $a['restriction']);
-                if (isset($a['join']))
-                    $this->aCurrent['join'] = array_merge($this->aCurrent['join'], $a['join']);
-                if (isset($a['restriction']) || isset($a['join']))
-                    $this->setProcessPrivateContent(false);
-
-                $this->sBrowseUrl = 'browse/recent';
+                $this->sBrowseUrl = 'page.php?i=notes-home';
                 $this->aCurrent['title'] = _t('_bx_notes_page_title_browse_recent');
                 break;
 
@@ -103,17 +81,38 @@ class BxNotesSearchResult extends BxTemplSearchResult {
                 $this->isError = true;
         }
 
-        // $this->aCurrent['paginate']['perPage'] = $oModuleMain->_oDb->getParam('bx_groups_perpage_browse'); // TODO:
+        // add replacable markers and replace them
+        if ($oProfileAuthor) {
+            $this->addMarkers($oProfileAuthor->getInfo()); // profile info is replacable
+            $this->addMarkers(array('profile_id' => $oProfileAuthor->id())); // profile id is replacable
+            $this->addMarkers(array('display_name' => $oProfileAuthor->getDisplayName())); // profile display name is replacable
+        }
+
+        $this->sBrowseUrl = $this->_replaceMarkers($this->sBrowseUrl);
+        $this->aCurrent['title'] = $this->_replaceMarkers($this->aCurrent['title']);
 
+        // add conditions for private content
+        bx_import('BxDolPrivacy');
+        $oPrivacy = BxDolPrivacy::getObjectInstance(BxNotesConfig::$OBJECT_PRIVACY_VIEW);
+        $a = $oPrivacy ? $oPrivacy->getContentPublicAsCondition('view', $oProfileAuthor ? $oProfileAuthor->id() : 0) : array();
+        if (isset($a['restriction']))
+            $this->aCurrent['restriction'] = array_merge($this->aCurrent['restriction'], $a['restriction']);
+        if (isset($a['join']))
+            $this->aCurrent['join'] = array_merge($this->aCurrent['join'], $a['join']);
+
+        $this->setProcessPrivateContent(false);
+
+        // set rss links if required
         if (isset($this->aCurrent['rss']))
-            $this->aCurrent['rss']['link'] = BX_DOL_URL_ROOT . $oModuleMain->_oConfig->getBaseUri() . $this->sBrowseUrl;
+            $this->aCurrent['rss']['link'] = BX_DOL_URL_ROOT . $this->sBrowseUrl;
 
-        if (bx_get('rss')) {
+        if (bx_get('rss'))
             $this->aCurrent['paginate']['perPage'] = 10;//$oModuleMain->_oDb->getParam('bx_groups_max_rss_num');
-        }
 
         $this->sFilterName = 'bx_notes_filter';
 
+        // $this->aCurrent['paginate']['perPage'] = $oModuleMain->_oDb->getParam('bx_groups_perpage_browse'); // TODO:
+
         parent::__construct();
     }
 

+ 8 - 8
modules/boonex/notes/install/langs/en.xml

@@ -53,9 +53,8 @@
 	<string name="_bx_notes_page_block_title_note_menu"><![CDATA[Note Menu]]></string>
 	<string name="_bx_notes_page_title_browse"><![CDATA[Notes]]></string>
 	<string name="_bx_notes_page_title_search_results"><![CDATA[Notes matching "{0}"]]></string>
-	<string name="_bx_notes_page_title_browse_by_author"><![CDATA[Notes by {0}]]></string>
+	<string name="_bx_notes_page_title_browse_by_author"><![CDATA[Notes of {display_name}]]></string>
     <string name="_bx_notes_page_title_browse_recent"><![CDATA[Recent Notes]]></string>
-    <string name="_bx_notes_page_title_browse_my"><![CDATA[My Notes]]></string>
     <string name="_bx_notes_page_title_sys_notes_home"><![CDATA[Notes Home]]></string>
     <string name="_bx_notes_page_title_notes_home"><![CDATA[Notes]]></string>
     <string name="_bx_notes_page_block_title_recent_notes"><![CDATA[Recent Notes]]></string>
@@ -65,12 +64,11 @@
     <string name="_bx_notes_page_title_sys_notes_featured"><![CDATA[Featured Notes]]></string>
     <string name="_bx_notes_page_title_notes_featured"><![CDATA[Featured Notes]]></string>
     <string name="_bx_notes_page_block_title_featured_notes"><![CDATA[Featured Notes]]></string>
-    <string name="_bx_notes_page_title_sys_notes_my"><![CDATA[My Notes]]></string>
-    <string name="_bx_notes_page_title_notes_my"><![CDATA[My Notes]]></string>
-    <string name="_bx_notes_page_block_title_my_notes"><![CDATA[My Notes]]></string>
     <string name="_bx_notes_page_title_sys_view_note_comments"><![CDATA[Note Comments]]></string>
     <string name="_bx_notes_page_title_view_note_comments"><![CDATA[Note Comments]]></string>
-    
+    <string name="_bx_notes_page_title_sys_notes_author"><![CDATA[Notes of author]]></string>
+    <string name="_bx_notes_page_title_notes_author"><![CDATA[Notes of {display_name}]]></string>
+    <string name="_bx_notes_page_block_title_notes_author"><![CDATA[Notes of author]]></string>   
 
     <string name="_bx_notes_menu_set_title_view_note"><![CDATA[View Note]]></string>
     <string name="_bx_notes_menu_title_view_note"><![CDATA[View Note]]></string>
@@ -90,13 +88,15 @@
     <string name="_bx_notes_menu_item_title_notes_public"><![CDATA[Public]]></string>
     <string name="_bx_notes_menu_item_title_system_notes_featured"><![CDATA[Featured]]></string>
     <string name="_bx_notes_menu_item_title_notes_featured"><![CDATA[Featured]]></string>
-    <string name="_bx_notes_menu_item_title_system_notes_my"><![CDATA[My Notes]]></string>
-    <string name="_bx_notes_menu_item_title_notes_my"><![CDATA[My Notes]]></string>
     <string name="_bx_notes_menu_title_view_note_submenu"><![CDATA[View Note Submenu]]></string>
     <string name="_bx_notes_menu_set_title_view_note_submenu"><![CDATA[View Note Submenu]]></string>
     <string name="_bx_notes_menu_item_title_view_note_submenu_note"><![CDATA[Note]]></string>
     <string name="_bx_notes_menu_item_title_view_note_submenu_comments"><![CDATA[Comments]]></string>
     <string name="_bx_notes_menu_item_title_system_view_note_comments"><![CDATA[Note Comments]]></string>
+    <string name="_bx_notes_menu_item_title_system_view_notes_author"><![CDATA[Notes]]></string>
+    <string name="_bx_notes_menu_item_title_view_notes_author"><![CDATA[Notes]]></string>
+    <string name="_bx_notes_menu_title_notes_my"><![CDATA[My Notes Action Menu]]></string>
+    <string name="_bx_notes_menu_set_title_notes_my"><![CDATA[My Notes Menu]]></string>
 
 	<string name="_bx_notes_txt_error_note_creation"><![CDATA[Note creation failed]]></string>
 	<string name="_bx_notes_txt_error_note_update"><![CDATA[Note update failed]]></string>

+ 2 - 2
modules/boonex/notes/install/sql/disable.sql

@@ -20,13 +20,13 @@ TRUNCATE TABLE `bx_notes_photos_resized`;
 -- PAGES
 
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_notes';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_notes' OR `object` IN('bx_notes_create_note', 'bx_notes_edit_note', 'bx_notes_view_note', 'bx_notes_view_note_comments', 'bx_notes_home', 'bx_notes_featured', 'bx_notes_my');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_notes' OR `object` IN('bx_notes_create_note', 'bx_notes_edit_note', 'bx_notes_view_note', 'bx_notes_view_note_comments', 'bx_notes_home', 'bx_notes_featured', 'bx_notes_author');
 
 -- MENU
 
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_notes';
 DELETE FROM `sys_menu_sets` WHERE `module` = 'bx_notes';
-DELETE FROM `sys_menu_items` WHERE `module` = 'bx_notes' OR `set_name` IN('bx_notes_view', 'bx_notes_submenu', 'bx_notes_view_submenu');
+DELETE FROM `sys_menu_items` WHERE `module` = 'bx_notes' OR `set_name` IN('bx_notes_view', 'bx_notes_submenu', 'bx_notes_view_submenu', 'bx_notes_my');
 
 -- PRIVACY 
 

+ 25 - 12
modules/boonex/notes/install/sql/enable.sql

@@ -36,7 +36,7 @@ INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `fil
 -- Dumping data for 'bx_notes_create_note' page
 --
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_notes_create_note', '_bx_notes_page_title_sys_create_note', '_bx_notes_page_title_create_note', 'bx_notes', 5, 2147483647, 1, 'create-note', 'page.php?i=create-note', '', '', '', 0, 1, 0, '', '');
+('bx_notes_create_note', '_bx_notes_page_title_sys_create_note', '_bx_notes_page_title_create_note', 'bx_notes', 5, 2147483647, 1, 'create-note', 'page.php?i=create-note', '', '', '', 0, 1, 0, 'BxNotesPageBrowse', 'modules/boonex/notes/classes/BxNotesPageBrowse.php');
 
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
 ('bx_notes_create_note', 1, 'bx_notes', '_bx_notes_page_block_title_create_note', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:13:"entity_create";}', 0, 1, 1);
@@ -71,7 +71,6 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbo
 ('bx_notes_view_note', 1, 'bx_notes', '_bx_notes_page_block_title_note_social_sharing', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:21:\"entity_social_sharing\";}', 0, 0, 2),
 ('bx_notes_view_note', 1, 'bx_notes', '_bx_notes_page_block_title_note_comments', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:15:\"entity_comments\";}', 0, 0, 3);
 
-
 --
 -- Dumping data for 'bx_notes_view_note_comments' page
 -- 
@@ -81,7 +80,6 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
 ('bx_notes_view_note_comments', 1, 'bx_notes', '_bx_notes_page_block_title_note_comments', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:15:\"entity_comments\";}', 0, 0, 1);
 
-
 --
 -- Dumping data for 'bx_notes_home' page
 -- 
@@ -101,15 +99,13 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbo
 ('bx_notes_featured', 1, 'bx_notes', '_bx_notes_page_block_title_featured_notes', 0, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:15:\"browse_featured\";}', 0, 1, 1);
 
 --
--- Dumping data for 'bx_notes_my' page
+-- Dumping data for 'bx_notes_author' page
 --
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_notes_my', 'notes-my', '_bx_notes_page_title_sys_notes_my', '_bx_notes_page_title_notes_my', 'bx_notes', 5, 254, 1, 'page.php?i=notes-my', '', '', '', 0, 1, 0, 'BxNotesPageBrowse', 'modules/boonex/notes/classes/BxNotesPageBrowse.php');
+('bx_notes_author', 'notes-author', '_bx_notes_page_title_sys_notes_author', '_bx_notes_page_title_notes_author', 'bx_notes', 5, 2147483647, 1, '', '', '', '', 0, 1, 0, 'BxNotesPageAuthor', 'modules/boonex/notes/classes/BxNotesPageAuthor.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_notes_my', 1, 'bx_notes', '_bx_notes_page_block_title_my_notes', 0, 254, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:9:\"browse_my\";}', 0, 1, 1);
-
-
+('bx_notes_author', 1, 'bx_notes', '_bx_notes_page_block_title_notes_author', 0, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:13:\"browse_author\";}', 0, 0, 1);
 
 
 -- MENU
@@ -126,7 +122,7 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
 -- Dumping data for 'bx_notes_view' menu
 --
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
-('bx_notes_view', '_bx_notes_menu_title_view_note', 'bx_notes_view', 'bx_notes', 10, 0, 1, 'BxNotesMenuViewNote', 'modules/boonex/notes/classes/BxNotesMenuViewNote.php');
+('bx_notes_view', '_bx_notes_menu_title_view_note', 'bx_notes_view', 'bx_notes', 10, 0, 1, 'BxNotesMenuView', 'modules/boonex/notes/classes/BxNotesMenuView.php');
 
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_notes_view', 'bx_notes', '_bx_notes_menu_set_title_view_note', 0);
@@ -136,6 +132,18 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_notes_view', 'bx_notes', 'edit-note', '_bx_notes_menu_item_title_system_edit_note', '_bx_notes_menu_item_title_edit_note', 'page.php?i=edit-note&id={content_id}', '', '', 'pencil', '', 0, 1, 0, 1),
 ('bx_notes_view', 'bx_notes', 'delete-note', '_bx_notes_menu_item_title_system_delete_note', '_bx_notes_menu_item_title_delete_note', 'page.php?i=delete-note&id={content_id}', '', '', 'remove', '', 0, 1, 0, 2);
 
+--
+-- Dumping data for 'bx_notes_my' menu
+--
+INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
+('bx_notes_my', '_bx_notes_menu_title_notes_my', 'bx_notes_my', 'bx_notes', 10, 0, 1, 'BxNotesMenuMy', 'modules/boonex/notes/classes/BxNotesMenuMy.php');
+
+INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
+('bx_notes_my', 'bx_notes', '_bx_notes_menu_set_title_notes_my', 0);
+
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
+('bx_notes_my', 'bx_notes', 'create-note', '_bx_notes_menu_item_title_system_create_note', '_bx_notes_menu_item_title_create_note', 'page.php?i=create-note', '', '', 'plus', '', 0, 1, 0, 0);
+
 --
 -- Dumping data for 'bx_notes_submenu' menu
 --
@@ -147,14 +155,13 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
 ('bx_notes_submenu', 'bx_notes', 'notes-home', '_bx_notes_menu_item_title_system_notes_public', '_bx_notes_menu_item_title_notes_public', 'page.php?i=notes-home', '', '', '', '', 2147483647, 1, 1, 1),
-('bx_notes_submenu', 'bx_notes', 'notes-featured', '_bx_notes_menu_item_title_system_notes_featured', '_bx_notes_menu_item_title_notes_featured', 'page.php?i=notes-featured', '', '', '', '', 2147483647, 1, 1, 2),
-('bx_notes_submenu', 'bx_notes', 'notes-my', '_bx_notes_menu_item_title_system_notes_my', '_bx_notes_menu_item_title_notes_my', 'page.php?i=notes-my', '', '', '', '', 254, 1, 1, 3);
+('bx_notes_submenu', 'bx_notes', 'notes-featured', '_bx_notes_menu_item_title_system_notes_featured', '_bx_notes_menu_item_title_notes_featured', 'page.php?i=notes-featured', '', '', '', '', 2147483647, 1, 1, 2);
 
 --
 -- Dumping data for 'bx_notes_view_submenu' menu
 --
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
-('bx_notes_view_submenu', '_bx_notes_menu_title_view_note_submenu', 'bx_notes_view_submenu', 'bx_notes', 8, 0, 1, 'BxNotesMenuViewNote', 'modules/boonex/notes/classes/BxNotesMenuViewNote.php');
+('bx_notes_view_submenu', '_bx_notes_menu_title_view_note_submenu', 'bx_notes_view_submenu', 'bx_notes', 8, 0, 1, 'BxNotesMenuView', 'modules/boonex/notes/classes/BxNotesMenuView.php');
 
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_notes_view_submenu', 'bx_notes', '_bx_notes_menu_set_title_view_note_submenu', 0);
@@ -164,6 +171,12 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_notes_view_submenu', 'bx_notes', 'view-note-comments', '_bx_notes_menu_item_title_system_view_note_comments', '_bx_notes_menu_item_title_view_note_submenu_comments', 'page.php?i=view-note-comments&id={content_id}', '', '', '', '', 2147483647, 1, 0, 2);
 
 
+-- NOTES menu in PROFILES module
+SET @iProfileMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'bx_persons_view_submenu' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
+('bx_persons_view_submenu', 'bx_notes', 'notes-author', '_bx_notes_menu_item_title_system_view_notes_author', '_bx_notes_menu_item_title_view_notes_author', 'page.php?i=notes-author&profile_id={profile_id}', '', '', '', '', 2147483647, 1, 0, IFNULL(@iProfileMenuOrder, 0) + 1);
+
+
 -- 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

+ 17 - 10
modules/boonex/persons/classes/BxPersonsMenuViewPerson.php

@@ -10,32 +10,36 @@
  */
 
 bx_import('BxTemplMenu');
+bx_import('BxDolProfile');
 
 /**
  * 'View person' menu.
  */
 class BxPersonsMenuViewPerson extends BxTemplMenu {
 
+    protected $_oProfile;
     protected $_aContentInfo;
+    protected $_aProfileInfo;
     protected $_oModule;
 
     public function __construct($aObject, $oTemplate = false) {
         parent::__construct($aObject, $oTemplate);
 
+        $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
         $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        if ($iProfileId)
+            $this->_oProfile = BxDolProfile::getInstance($iProfileId);
+        if (!$this->_oProfile && $iContentId)
+            $this->_oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, 'bx_persons');
 
-        $this->_oModule = BxDolModule::getInstance('bx_persons');
-        $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
+        if ($this->_oProfile) {
+            $this->_aProfileInfo = $this->_oProfile->getInfo();
 
-        if ($this->_aContentInfo) {
+            $this->_oModule = BxDolModule::getInstance('bx_persons');
+            $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_aProfileInfo['content_id']);
 
-            $oProfileAuthor = BxDolProfile::getInstance($this->_aContentInfo[BxPersonsConfig::$FIELD_AUTHOR]);
-            $oProfile = $oProfileAuthor ? BxDolProfile::getInstanceByContentTypeAccount($iContentId, 'bx_persons', $oProfileAuthor->getAccountId()) : false;
-
-            $this->addMarkers(array(
-                'content_id' => $this->_aContentInfo['id'],
-                'profile_id' => $oProfile ? $oProfile->id() : 0
-            ));
+            $this->addMarkers($this->_aProfileInfo);
+            $this->addMarkers(array('profile_id' => $this->_oProfile->id()));
         }
     }
 
@@ -80,6 +84,9 @@ class BxPersonsMenuViewPerson extends BxTemplMenu {
                 break;
         }
 
+        if (!$sFuncCheckAccess)
+            return true;
+
         return $sFuncCheckAccess && CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->$sFuncCheckAccess($this->_aContentInfo) ? true : false;
     }
 

+ 7 - 4
modules/boonex/persons/classes/BxPersonsPageProfile.php

@@ -21,6 +21,7 @@ bx_import('BxDolInformer');
 class BxPersonsPageProfile extends BxTemplPage {    
     
     protected $_aContentInfo;
+    protected $_aProfileInfo;
     protected $_oProfile;
     protected $_oProfileAuthor;
 
@@ -41,14 +42,15 @@ class BxPersonsPageProfile extends BxTemplPage {
             $this->_aContentInfo = $oModuleMain->_oDb->getContentInfoById($iContentId);
             $this->_oProfileAuthor = $this->_aContentInfo ? BxDolProfile::getInstance($this->_aContentInfo[BxPersonsConfig::$FIELD_AUTHOR]) : false;
             $this->_oProfile = $this->_oProfileAuthor ? BxDolProfile::getInstanceByContentTypeAccount($iContentId, 'bx_persons', $this->_oProfileAuthor->getAccountId()) : false;
+            $this->_aProfileInfo = $this->_oProfile ? $this->_oProfile->getInfo() : array();
         }
 
         if (!$this->_aContentInfo || !$this->_oProfile)
             return;
 
-        // select view note submenu        
-        $oMenuSumbemu = BxDolMenu::getObjectInstance('sys_site_submenu');
-        $oMenuSumbemu->setObjectSubmenu('bx_persons_view_submenu', array (
+        // select view profile submenu 
+        $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
+        $oMenuSubmenu->setObjectSubmenu('bx_persons_view_submenu', array (
             'title' => $this->_oProfile->getDisplayName(),
             'link' => $this->_oProfile->getUrl(),
             'icon' => $this->_oProfile->getIcon(),
@@ -59,8 +61,9 @@ class BxPersonsPageProfile extends BxTemplPage {
         $oMenuAction->setActionsMenu('bx_persons_view');        
 
         // add replaceable markers
-        $this->addMarkers($this->_aContentInfo); // every profile field can be used as marker
+        $this->addMarkers($this->_aProfileInfo); // every content field can be used as marker
         $this->addMarkers(array('profile_id' => $this->_oProfile->id())); // profile id field is also suported
+        $this->addMarkers(array('display_name' => $this->_oProfile->getDisplayName())); // profile display name is also suported
 
         // display message if profile isn't active
         if (bx_get_logged_profile_id() == $this->_oProfileAuthor->id()) { 

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

@@ -50,10 +50,10 @@
 	<string name="_bx_persons_page_title_sys_delete_profile"><![CDATA[Delete Person's Profile]]></string>
 	<string name="_bx_persons_page_title_delete_profile"><![CDATA[Delete Profile]]></string>
 	<string name="_bx_persons_page_title_sys_view_profile"><![CDATA[View Person's Profile]]></string>
-	<string name="_bx_persons_page_title_view_profile"><![CDATA[{fullname}]]></string>
+	<string name="_bx_persons_page_title_view_profile"><![CDATA[{display_name}]]></string>
 	<string name="_bx_persons_page_title_browse_recent"><![CDATA[Persons]]></string>
 	<string name="_bx_persons_page_title_sys_profile_info"><![CDATA[Profile Info]]></string>
-	<string name="_bx_persons_page_title_profile_info"><![CDATA[Info about {fullname}]]></string>
+	<string name="_bx_persons_page_title_profile_info"><![CDATA[Info about {display_name}]]></string>
 
 	<string name="_bx_persons_page_block_title_create_profile"><![CDATA[Create Person's Profile]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile"><![CDATA[Edit Profile]]></string>

+ 12 - 12
template/scripts/BxBaseSearchResult.php

@@ -19,7 +19,6 @@ class BxBaseSearchResult extends BxDolSearchResult {
     protected $sFilterName;
 
     protected $iDesignBoxTemplate = BX_DB_PADDING_DEF;
-    protected $aPermalinks;
     protected $aConstants;
 
     function __construct($oFunctions = false) {
@@ -37,10 +36,6 @@ class BxBaseSearchResult extends BxDolSearchResult {
         // override this to return main module class
     }
 
-    function isPermalinkEnabled() {
-       return isset($this->_isPermalinkEnabled) ? $this->_isPermalinkEnabled : ($this->_isPermalinkEnabled = (getParam($this->aPermalinks['param']) == 'on'));
-    }
-
     function getCurrentUrl ($sType, $iId, $sUri, $aOwner = '') {
         $sLink = $this->aConstants['linksTempl'][$sType];
         $sLink = str_replace('{id}', $iId, $sLink);
@@ -184,12 +179,14 @@ class BxBaseSearchResult extends BxDolSearchResult {
 EOF;
     }
 
-    function showPagination($bAdmin = false, $bChangePage = true, $bPageReload = true) {
-
+    function showPagination($bAdmin = false, $bChangePage = true, $bPageReload = true)
+    {
         $oMain = $this->getMain();
         $oConfig = $oMain->_oConfig;
-        bx_import('BxDolPaginate');
-        $sUrlStart = BX_DOL_URL_ROOT . $oConfig->getBaseUri() . $this->sBrowseUrl;
+
+        bx_import('BxDolPermalinks');
+        $oPermalinks = BxDolPermalinks::getInstance();
+        $sUrlStart = BX_DOL_URL_ROOT . $oPermalinks->permalink($this->sBrowseUrl);
         $sUrlStart .= (false === strpos($sUrlStart, '?') ? '?' : '&');
 
         bx_import('BxTemplPaginate');
@@ -206,11 +203,14 @@ EOF;
     function showPaginationAjax($sBlockId) {
         $oMain = $this->getMain();
         $oConfig = $oMain->_oConfig;
-        bx_import('BxDolPaginate');
-        $sUrlStart = BX_DOL_URL_ROOT . $oConfig->getBaseUri() . $this->sBrowseUrl;
+        
+        bx_import('BxDolPermalinks');
+        $oPermalinks = BxDolPermalinks::getInstance();
+        $sUrlStart = BX_DOL_URL_ROOT . $oPermalinks->permalink($this->sBrowseUrl);
         $sUrlStart .= (false === strpos($sUrlStart, '?') ? '?' : '&');
 
-        $oPaginate = new BxDolPaginate(array(
+        bx_import('BxTemplPaginate');
+        $oPaginate = new BxTemplPaginate(array(
             'page_url' => 'javascript:void(0);',
             'num' => $this->aCurrent['paginate']['num'],
             'per_page' => $this->aCurrent['paginate']['perPage'],