AntonLV 10 лет назад
Родитель
Сommit
34c309d2ea

+ 2 - 0
modules/boonex/posts/classes/BxPostsConfig.php

@@ -73,6 +73,7 @@ class BxPostsConfig extends BxBaseModTextConfig
         	'OBJECT_REPORTS' => 'bx_posts',
             'OBJECT_VIEWS' => 'bx_posts',
             'OBJECT_VOTES' => 'bx_posts',
+        	'OBJECT_FAVORITES' => 'bx_posts',
             'OBJECT_METATAGS' => 'bx_posts',
             'OBJECT_COMMENTS' => 'bx_posts',
             'OBJECT_PRIVACY_VIEW' => 'bx_posts_allow_view_to',
@@ -112,6 +113,7 @@ class BxPostsConfig extends BxBaseModTextConfig
             	'menu_item_manage_my' => '_bx_posts_menu_item_title_manage_my',
             	'menu_item_manage_all' => '_bx_posts_menu_item_title_manage_all',
                 'txt_all_entries_by' => '_bx_posts_txt_all_entries_by',
+                'txt_all_entries_by_author' => '_bx_posts_page_title_browse_by_author',
             	'txt_pict_use_as_thumb' => '_bx_posts_form_entry_input_picture_use_as_thumb'
             ),
         );

+ 4 - 11
modules/boonex/posts/classes/BxPostsSearchResult.php

@@ -54,19 +54,12 @@ class BxPostsSearchResult extends BxBaseModTextSearchResult
         $CNF = &$this->oModule->_oConfig->CNF;
 
         switch ($sMode) {
-
             case 'author':
-                $oProfileAuthor = BxDolProfile::getInstance((int)$aParams['author']);
-                if (!$oProfileAuthor) {
-                    $this->isError = true;
-                    break;
-                }
-
-                $this->aCurrent['restriction']['author']['value'] = $oProfileAuthor->id();
+                $this->_updateCurrentForAuthor($sMode, $aParams, $oProfileAuthor);
+                break;
 
-                $this->sBrowseUrl = 'page.php?i=' . $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id={profile_id}';
-                $this->aCurrent['title'] = _t('_bx_posts_page_title_browse_by_author');
-                $this->aCurrent['rss']['link'] = 'modules/?r=posts/rss/' . $sMode . '/' . $oProfileAuthor->id();
+            case 'favorite':
+                $this->_updateCurrentForFavorite($sMode, $aParams, $oProfileAuthor);
                 break;
 
             case 'public':

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

@@ -91,6 +91,8 @@
     <string name="_bx_posts_page_title_view_entry_comments"><![CDATA[Comments to {title}]]></string>
     <string name="_bx_posts_page_title_sys_entries_of_author"><![CDATA[Posts of author]]></string>
     <string name="_bx_posts_page_title_entries_of_author"><![CDATA[Posts by {display_name}]]></string>
+    <string name="_bx_posts_page_block_title_favorites_of_author"><![CDATA[Favorites by <a href="{profile_link}">{display_name}</a>]]></string>
+    <string name="_bx_posts_page_block_title_sys_favorites_of_author"><![CDATA[Favorites of author]]></string>
     <string name="_bx_posts_page_block_title_entries_of_author"><![CDATA[Posts by <a href="{profile_link}">{display_name}</a>]]></string>
     <string name="_bx_posts_page_block_title_sys_entries_of_author"><![CDATA[Posts of author]]></string>   
     <string name="_bx_posts_page_block_title_entries_actions"><![CDATA[Posts actions]]></string>

+ 4 - 3
modules/boonex/posts/install/sql/enable.sql

@@ -52,9 +52,9 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
 ('bx_posts_view_entry', 1, 'bx_posts', '', '_bx_posts_page_block_title_entry_text', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:17:\"entity_text_block\";}', 0, 0, 1, 0),
 ('bx_posts_view_entry', 2, 'bx_posts', '', '_bx_posts_page_block_title_entry_author', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:13:\"entity_author\";}', 0, 0, 1, 0),
-('bx_posts_view_entry', 2, 'bx_posts', '', '_bx_posts_page_block_title_entry_all_actions', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:18:\"entity_all_actions\";}', 0, 0, 1, 1),
 ('bx_posts_view_entry', 3, 'bx_posts', '', '_bx_posts_page_block_title_entry_info', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:11:\"entity_info\";}', 0, 0, 1, 1),
 ('bx_posts_view_entry', 3, 'bx_posts', '', '_bx_posts_page_block_title_entry_location', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"entity_location\";}', 0, 0, 0, 2),
+('bx_posts_view_entry', 4, 'bx_posts', '', '_bx_posts_page_block_title_entry_all_actions', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:18:\"entity_all_actions\";}', 0, 0, 1, 0),
 ('bx_posts_view_entry', 4, 'bx_posts', '', '_bx_posts_page_block_title_entry_actions', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:14:\"entity_actions\";}', 0, 0, 0, 1),
 ('bx_posts_view_entry', 4, 'bx_posts', '', '_bx_posts_page_block_title_entry_social_sharing', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:21:\"entity_social_sharing\";}', 0, 0, 0, 2),
 ('bx_posts_view_entry', 4, 'bx_posts', '', '_bx_posts_page_block_title_entry_attachments', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:18:\"entity_attachments\";}', 0, 0, 0, 3),
@@ -95,8 +95,9 @@ INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module
 ('bx_posts_author', 'posts-author', '_bx_posts_page_title_sys_entries_of_author', '_bx_posts_page_title_entries_of_author', 'bx_posts', 5, 2147483647, 1, '', '', '', '', 0, 1, 0, 'BxPostsPageAuthor', 'modules/boonex/posts/classes/BxPostsPageAuthor.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
-('bx_posts_author', 1, 'bx_posts', '', '_bx_posts_page_block_title_entries_actions', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:18:\"my_entries_actions\";}', 0, 0, 1, 0),
-('bx_posts_author', 1, 'bx_posts', '_bx_posts_page_block_title_sys_entries_of_author', '_bx_posts_page_block_title_entries_of_author', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:13:\"browse_author\";}', 0, 0, 1, 1);
+('bx_posts_author', 1, 'bx_posts', '', '_bx_posts_page_block_title_entries_actions', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:18:\"my_entries_actions\";}', 0, 0, 1, 1),
+('bx_posts_author', 1, 'bx_posts', '_bx_posts_page_block_title_sys_favorites_of_author', '_bx_posts_page_block_title_favorites_of_author', 11, 2147483647, 'service', 'a:3:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:15:\"browse_favorite\";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 1, 1, 2),
+('bx_posts_author', 1, 'bx_posts', '_bx_posts_page_block_title_sys_entries_of_author', '_bx_posts_page_block_title_entries_of_author', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_posts\";s:6:\"method\";s:13:\"browse_author\";}', 0, 0, 1, 3);
 
 -- PAGE: module home
 

+ 16 - 0
modules/boonex/posts/install/sql/install.sql

@@ -13,6 +13,7 @@ CREATE TABLE IF NOT EXISTS `bx_posts_posts` (
   `views` int(11) NOT NULL default '0',
   `rate` float NOT NULL default '0',
   `votes` int(11) NOT NULL default '0',
+  `favorites` int(11) NOT NULL default '0',
   `comments` int(11) NOT NULL default '0',
   `reports` int(11) NOT NULL default '0',
   `allow_view_to` int(11) NOT NULL DEFAULT '3',
@@ -148,6 +149,16 @@ CREATE TABLE IF NOT EXISTS `bx_posts_reports_track` (
   KEY `report` (`object_id`, `author_nip`)
 ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
 
+-- TABLE: favorites
+
+CREATE TABLE `bx_posts_favorites_track` (
+  `object_id` int(11) NOT NULL default '0',
+  `author_id` int(11) NOT NULL default '0',
+  `date` int(11) NOT NULL default '0',
+  KEY `id` (`object_id`,`author_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+
 -- STORAGES & TRANSCODERS
 
 INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
@@ -287,6 +298,11 @@ INSERT INTO `sys_objects_report` (`name`, `table_main`, `table_track`, `is_on`,
 INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
 ('bx_posts', 'bx_posts_views_track', '86400', '1', 'bx_posts_posts', 'id', 'views', '', '');
 
+-- FAFORITES
+
+INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_posts', 'bx_posts_favorites_track', '1', '1', '1', 'page.php?i=view-post&id={object_id}', 'bx_posts_posts', 'id', 'author', 'favorites', '', '');
+
 -- STUDIO: page & widget
 
 INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES

+ 5 - 1
modules/boonex/posts/install/sql/uninstall.sql

@@ -1,7 +1,7 @@
 
 -- TABLES
 
-DROP TABLE IF EXISTS `bx_posts_posts`, `bx_posts_files`, `bx_posts_photos_resized`, `bx_posts_cmts`, `bx_posts_votes`, `bx_posts_votes_track`, `bx_posts_views_track`, `bx_posts_meta_keywords`, `bx_posts_meta_locations`, `bx_posts_reports`, `bx_posts_reports_track`;
+DROP TABLE IF EXISTS `bx_posts_posts`, `bx_posts_files`, `bx_posts_photos_resized`, `bx_posts_cmts`, `bx_posts_votes`, `bx_posts_votes_track`, `bx_posts_views_track`, `bx_posts_meta_keywords`, `bx_posts_meta_locations`, `bx_posts_reports`, `bx_posts_reports_track`, `bx_posts_favorites_track`;
 
 -- STORAGES & TRANSCODERS
 
@@ -41,6 +41,10 @@ DELETE FROM `sys_objects_report` WHERE `Name` = 'bx_posts';
 
 DELETE FROM `sys_objects_view` WHERE `Name` = 'bx_posts';
 
+-- FAFORITES
+
+DELETE FROM `sys_objects_favorite` WHERE `Name` = 'bx_posts';
+
 -- STUDIO: page & widget
 
 DELETE FROM `tp`, `tw`, `tpw`

+ 1 - 3
modules/boonex/posts/template/entry-share.html

@@ -1,3 +1 @@
-
-<bx_include_base:../modules/base/text/template/entry-share.html />
-
+<bx_include_base:../modules/base/text/template/entry-share.html />

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

@@ -91,6 +91,8 @@
     <string name="_bx_posts_page_title_view_entry_comments"><![CDATA[Комментарии к {title}]]></string>
     <string name="_bx_posts_page_title_sys_entries_of_author"><![CDATA[Публикации автора]]></string>
     <string name="_bx_posts_page_title_entries_of_author"><![CDATA[{display_name} - Публикации]]></string>
+    <string name="_bx_posts_page_block_title_favorites_of_author"><![CDATA[<a href="{profile_link}">{display_name}</a> - Избранное]]></string>   
+    <string name="_bx_posts_page_block_title_sys_favorites_of_author"><![CDATA[Избранное автора]]></string>
     <string name="_bx_posts_page_block_title_entries_of_author"><![CDATA[<a href="{profile_link}">{display_name}</a> - Публикации]]></string>   
     <string name="_bx_posts_page_block_title_sys_entries_of_author"><![CDATA[Публикации автора]]></string>   
     <string name="_bx_posts_page_block_title_entries_actions"><![CDATA[Публикации - Действия]]></string>