Ver código fonte

Ticket #2139 - Integration with Forum and Glossary.

AntonLV 7 anos atrás
pai
commit
a18d6be970

+ 1 - 1
modules/boonex/albums/install/sql/uninstall.sql

@@ -25,7 +25,7 @@ DELETE FROM `sys_objects_cmts` WHERE `Name` = 'bx_albums' OR `Name` = 'bx_albums
 
 
 -- VOTES
-DELETE FROM `sys_objects_vote` WHERE `Name` = 'bx_albums' OR `Name` = 'bx_albums_media';
+DELETE FROM `sys_objects_vote` WHERE `Name` IN ('bx_albums', 'bx_albums_media', 'bx_albums_reactions');
 
 
 -- SCORES

+ 1 - 1
modules/boonex/files/install/sql/uninstall.sql

@@ -25,7 +25,7 @@ DELETE FROM `sys_form_pre_values` WHERE `Key` IN('bx_files_cats');
 DELETE FROM `sys_objects_cmts` WHERE `Name` = 'bx_files';
 
 -- VOTES
-DELETE FROM `sys_objects_vote` WHERE `Name` = 'bx_files';
+DELETE FROM `sys_objects_vote` WHERE `Name` IN ('bx_files', 'bx_files_reactions');
 
 -- SCORES
 DELETE FROM `sys_objects_score` WHERE `name` = 'bx_files';

+ 1 - 0
modules/boonex/forum/classes/BxForumConfig.php

@@ -107,6 +107,7 @@ class BxForumConfig extends BxBaseModTextConfig
             'OBJECT_REPORTS' => 'bx_forum',
             'OBJECT_VIEWS' => 'bx_forum',
             'OBJECT_VOTES' => 'bx_forum',
+            'OBJECT_REACTIONS' => 'bx_forum_reactions',
             'OBJECT_SCORES' => 'bx_forum',
             'OBJECT_FAVORITES' => 'bx_forum',
             'OBJECT_FEATURED' => 'bx_forum',

+ 2 - 1
modules/boonex/forum/install/sql/enable.sql

@@ -248,7 +248,8 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_forum_view_actions', @sName, 'delete-discussion', '_bx_forum_menu_item_title_system_delete_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 100),
 ('bx_forum_view_actions', @sName, 'comment', '_sys_menu_item_title_system_va_comment', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 200),
 ('bx_forum_view_actions', @sName, 'view', '_sys_menu_item_title_system_va_view', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 210),
-('bx_forum_view_actions', @sName, 'vote', '_sys_menu_item_title_system_va_vote', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 220),
+('bx_forum_view_actions', @sName, 'vote', '_sys_menu_item_title_system_va_vote', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 220),
+('bx_forum_view_actions', @sName, 'reaction', '_sys_menu_item_title_system_va_reaction', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 225),
 ('bx_forum_view_actions', @sName, 'score', '_sys_menu_item_title_system_va_score', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 230),
 ('bx_forum_view_actions', @sName, 'favorite', '_sys_menu_item_title_system_va_favorite', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 240),
 ('bx_forum_view_actions', @sName, 'feature', '_sys_menu_item_title_system_va_feature', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 250),

+ 24 - 1
modules/boonex/forum/install/sql/install.sql

@@ -18,6 +18,8 @@ CREATE TABLE IF NOT EXISTS `bx_forum_discussions` (
   `views` int(11) NOT NULL default '0',
   `rate` float NOT NULL default '0',
   `votes` int(11) NOT NULL default '0',
+  `rrate` float NOT NULL default '0',
+  `rvotes` int(11) NOT NULL default '0',
   `score` int(11) NOT NULL default '0',
   `sc_up` int(11) NOT NULL default '0',
   `sc_down` int(11) NOT NULL default '0',
@@ -132,6 +134,26 @@ CREATE TABLE IF NOT EXISTS `bx_forum_votes_track` (
   KEY `vote` (`object_id`, `author_nip`)
 );
 
+CREATE TABLE IF NOT EXISTS `bx_forum_reactions` (
+  `object_id` int(11) NOT NULL default '0',
+  `reaction` varchar(32) NOT NULL default '',
+  `count` int(11) NOT NULL default '0',
+  `sum` int(11) NOT NULL default '0',
+  UNIQUE KEY `reaction` (`object_id`, `reaction`)
+);
+
+CREATE TABLE IF NOT EXISTS `bx_forum_reactions_track` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object_id` int(11) NOT NULL default '0',
+  `author_id` int(11) NOT NULL default '0',
+  `author_nip` int(11) unsigned NOT NULL default '0',
+  `reaction` varchar(32) NOT NULL default '',
+  `value` tinyint(4) NOT NULL default '0',
+  `date` int(11) NOT NULL default '0',
+  PRIMARY KEY (`id`),
+  KEY `vote` (`object_id`, `author_nip`)
+);
+
 -- TABLE: metas
 CREATE TABLE `bx_forum_meta_keywords` (
   `object_id` int(10) unsigned NOT NULL,
@@ -293,7 +315,8 @@ INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigg
 
 -- VOTES
 INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 
-(@sName, 'bx_forum_votes', 'bx_forum_votes_track', '604800', '1', '1', '0', '1', 'bx_forum_discussions', 'id', 'author', 'rate', 'votes', '', '');
+(@sName, 'bx_forum_votes', 'bx_forum_votes_track', '604800', '1', '1', '0', '1', 'bx_forum_discussions', 'id', 'author', 'rate', 'votes', '', ''),
+('bx_forum_reactions', 'bx_forum_reactions', 'bx_forum_reactions_track', '604800', '1', '1', '1', '1', 'bx_forum_discussions', 'id', 'author', 'rrate', 'rvotes', 'BxTemplVoteReactions', '');
 
 
 -- SCORES

+ 2 - 2
modules/boonex/forum/install/sql/uninstall.sql

@@ -2,7 +2,7 @@ SET @sName = 'bx_forum';
 
 
 -- TABLES: entries
-DROP TABLE IF EXISTS `bx_forum_discussions`, `bx_forum_categories`, `bx_forum_files`, `bx_forum_photos_resized`, `bx_forum_subscribers`, `bx_forum_cmts`, `bx_forum_views_track`, `bx_forum_votes`, `bx_forum_votes_track`, `bx_forum_meta_keywords`, `bx_forum_meta_mentions`, `bx_forum_reports`, `bx_forum_reports_track`, `bx_forum_favorites_track`, `bx_forum_scores`, `bx_forum_scores_track`;
+DROP TABLE IF EXISTS `bx_forum_discussions`, `bx_forum_categories`, `bx_forum_files`, `bx_forum_photos_resized`, `bx_forum_subscribers`, `bx_forum_cmts`, `bx_forum_views_track`, `bx_forum_votes`, `bx_forum_votes_track`, `bx_forum_reactions`, `bx_forum_reactions_track`, `bx_forum_meta_keywords`, `bx_forum_meta_mentions`, `bx_forum_reports`, `bx_forum_reports_track`, `bx_forum_favorites_track`, `bx_forum_scores`, `bx_forum_scores_track`;
 
 
 -- STORAGES & TRANSCODERS
@@ -35,7 +35,7 @@ DELETE FROM `sys_objects_view` WHERE `Name` = @sName;
 
 
 -- VOTES
-DELETE FROM `sys_objects_vote` WHERE `Name` = @sName;
+DELETE FROM `sys_objects_vote` WHERE `Name` IN (@sName, 'bx_forum_reactions');
 
 
 -- SCORES

+ 1 - 0
modules/boonex/glossary/classes/BxGlsrConfig.php

@@ -78,6 +78,7 @@ class BxGlsrConfig extends BxBaseModTextConfig
             'OBJECT_REPORTS' => 'bx_glossary',
             'OBJECT_VIEWS' => 'bx_glossary',
             'OBJECT_VOTES' => 'bx_glossary',
+            'OBJECT_REACTIONS' => 'bx_glossary_reactions',
             'OBJECT_SCORES' => 'bx_glossary',
             'OBJECT_FAVORITES' => 'bx_glossary',
             'OBJECT_FEATURED' => 'bx_glossary',

+ 2 - 1
modules/boonex/glossary/install/sql/enable.sql

@@ -217,7 +217,8 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_glossary_view_actions', 'bx_glossary', 'delete-glossary', '_bx_glossary_menu_item_title_system_delete_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 20),
 ('bx_glossary_view_actions', 'bx_glossary', 'comment', '_sys_menu_item_title_system_va_comment', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 200),
 ('bx_glossary_view_actions', 'bx_glossary', 'view', '_sys_menu_item_title_system_va_view', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 210),
-('bx_glossary_view_actions', 'bx_glossary', 'vote', '_sys_menu_item_title_system_va_vote', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 220),
+('bx_glossary_view_actions', 'bx_glossary', 'vote', '_sys_menu_item_title_system_va_vote', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 220),
+('bx_glossary_view_actions', 'bx_glossary', 'reaction', '_sys_menu_item_title_system_va_reaction', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 225),
 ('bx_glossary_view_actions', 'bx_glossary', 'score', '_sys_menu_item_title_system_va_score', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 230),
 ('bx_glossary_view_actions', 'bx_glossary', 'favorite', '_sys_menu_item_title_system_va_favorite', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 240),
 ('bx_glossary_view_actions', 'bx_glossary', 'feature', '_sys_menu_item_title_system_va_feature', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 250),

+ 24 - 1
modules/boonex/glossary/install/sql/install.sql

@@ -14,6 +14,8 @@ CREATE TABLE IF NOT EXISTS `bx_glossary_terms` (
   `views` int(11) NOT NULL default '0',
   `rate` float NOT NULL default '0',
   `votes` int(11) NOT NULL default '0',
+  `rrate` float NOT NULL default '0',
+  `rvotes` int(11) NOT NULL default '0',
   `score` int(11) NOT NULL default '0',
   `sc_up` int(11) NOT NULL default '0',
   `sc_down` int(11) NOT NULL default '0',
@@ -99,6 +101,26 @@ CREATE TABLE IF NOT EXISTS `bx_glossary_votes_track` (
   KEY `vote` (`object_id`, `author_nip`)
 );
 
+CREATE TABLE IF NOT EXISTS `bx_glossary_reactions` (
+  `object_id` int(11) NOT NULL default '0',
+  `reaction` varchar(32) NOT NULL default '',
+  `count` int(11) NOT NULL default '0',
+  `sum` int(11) NOT NULL default '0',
+  UNIQUE KEY `reaction` (`object_id`, `reaction`)
+);
+
+CREATE TABLE IF NOT EXISTS `bx_glossary_reactions_track` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object_id` int(11) NOT NULL default '0',
+  `author_id` int(11) NOT NULL default '0',
+  `author_nip` int(11) unsigned NOT NULL default '0',
+  `reaction` varchar(32) NOT NULL default '',
+  `value` tinyint(4) NOT NULL default '0',
+  `date` int(11) NOT NULL default '0',
+  PRIMARY KEY (`id`),
+  KEY `vote` (`object_id`, `author_nip`)
+);
+
 -- TABLE: views
 CREATE TABLE `bx_glossary_views_track` (
   `object_id` int(11) NOT NULL default '0',
@@ -272,7 +294,8 @@ INSERT INTO `sys_objects_cmts` (`Name`, `Module`, `Table`, `CharsPostMin`, `Char
 
 -- VOTES
 INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 
-('bx_glossary', 'bx_glossary_votes', 'bx_glossary_votes_track', '604800', '1', '1', '0', '1', 'bx_glossary_terms', 'id', 'author', 'rate', 'votes', '', '');
+('bx_glossary', 'bx_glossary_votes', 'bx_glossary_votes_track', '604800', '1', '1', '0', '1', 'bx_glossary_terms', 'id', 'author', 'rate', 'votes', '', ''),
+('bx_glossary_reactions', 'bx_glossary_reactions', 'bx_glossary_reactions_track', '604800', '1', '1', '1', '1', 'bx_glossary_terms', 'id', 'author', 'rrate', 'rvotes', 'BxTemplVoteReactions', '');
 
 -- SCORES
 INSERT INTO `sys_objects_score` (`name`, `module`, `table_main`, `table_track`, `post_timeout`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_score`, `trigger_field_cup`, `trigger_field_cdown`, `class_name`, `class_file`) VALUES 

+ 2 - 2
modules/boonex/glossary/install/sql/uninstall.sql

@@ -1,6 +1,6 @@
 
 -- TABLES
-DROP TABLE IF EXISTS `bx_glossary_terms`, `bx_glossary_files`, `bx_glossary_photos_resized`, `bx_glossary_cmts`, `bx_glossary_votes`, `bx_glossary_votes_track`, `bx_glossary_views_track`, `bx_glossary_meta_keywords`, `bx_glossary_meta_mentions`, `bx_glossary_reports`, `bx_glossary_reports_track`, `bx_glossary_favorites_track`, `bx_glossary_scores`, `bx_glossary_scores_track`;
+DROP TABLE IF EXISTS `bx_glossary_terms`, `bx_glossary_files`, `bx_glossary_photos_resized`, `bx_glossary_cmts`, `bx_glossary_votes`, `bx_glossary_votes_track`, `bx_glossary_reactions`, `bx_glossary_reactions_track`, `bx_glossary_views_track`, `bx_glossary_meta_keywords`, `bx_glossary_meta_mentions`, `bx_glossary_reports`, `bx_glossary_reports_track`, `bx_glossary_favorites_track`, `bx_glossary_scores`, `bx_glossary_scores_track`;
 
 -- STORAGES & TRANSCODERS
 DELETE FROM `sys_objects_storage` WHERE `object` = 'bx_glossary_files' OR `object` = 'bx_glossary_photos_resized';
@@ -25,7 +25,7 @@ DELETE FROM `sys_form_pre_values` WHERE `Key` IN('bx_glossary_cats');
 DELETE FROM `sys_objects_cmts` WHERE `Name` = 'bx_glossary';
 
 -- VOTES
-DELETE FROM `sys_objects_vote` WHERE `Name` = 'bx_glossary';
+DELETE FROM `sys_objects_vote` WHERE `Name` IN ('bx_glossary', 'bx_glossary_reactions');
 
 -- SCORES
 DELETE FROM `sys_objects_score` WHERE `name` = 'bx_glossary';