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

Ticket #1748 - Integration with Persons.

AntonLV 8 лет назад
Родитель
Сommit
c57bdf2805

+ 20 - 18
modules/boonex/persons/classes/BxPersonsConfig.php

@@ -41,12 +41,12 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'FIELD_ADDED' => 'added',
             'FIELD_CHANGED' => 'changed',
             'FIELD_NAME' => 'fullname',
-        	'FIELD_TITLE' => 'fullname',
-        	'FIELD_TEXT' => 'description',
+            'FIELD_TITLE' => 'fullname',
+            'FIELD_TEXT' => 'description',
             'FIELD_PICTURE' => 'picture',
             'FIELD_COVER' => 'cover',
             'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
-        	'FIELD_VIEWS' => 'views',
+            'FIELD_VIEWS' => 'views',
             'FIELD_COMMENTS' => 'comments',
             'FIELDS_QUICK_SEARCH' => array('fullname'),
             'FIELD_LOCATION_PREFIX' => 'location',
@@ -55,17 +55,17 @@ class BxPersonsConfig extends BxBaseModProfileConfig
 
             // page URIs
             'URI_VIEW_ENTRY' => 'view-persons-profile',
-        	'URI_VIEW_FRIENDS' => 'persons-profile-friends',
-        	'URI_VIEW_FRIEND_REQUESTS' => 'persons-friend-requests',
-        	'URI_VIEW_FAVORITES' => 'persons-profile-favorites',
+            'URI_VIEW_FRIENDS' => 'persons-profile-friends',
+            'URI_VIEW_FRIEND_REQUESTS' => 'persons-friend-requests',
+            'URI_VIEW_FAVORITES' => 'persons-profile-favorites',
             'URI_EDIT_ENTRY' => 'edit-persons-profile',
             'URI_EDIT_COVER' => 'edit-persons-cover',
-        	'URI_MANAGE_COMMON' => 'persons-manage',
+            'URI_MANAGE_COMMON' => 'persons-manage',
 
             'URL_HOME' => 'page.php?i=persons-home',
-        	'URL_CREATE' => 'page.php?i=create-persons-profile',
-        	'URL_MANAGE_COMMON' => 'page.php?i=persons-manage',
-        	'URL_MANAGE_ADMINISTRATION' => 'page.php?i=persons-administration',
+            'URL_CREATE' => 'page.php?i=create-persons-profile',
+            'URL_MANAGE_COMMON' => 'page.php?i=persons-manage',
+            'URL_MANAGE_ADMINISTRATION' => 'page.php?i=persons-administration',
 
             // some params
             'PARAM_AUTOAPPROVAL' => 'bx_persons_autoapproval',
@@ -92,17 +92,18 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'OBJECT_IMAGES_TRANSCODER_PICTURE' => 'bx_persons_picture',
             'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_persons_cover',
             'OBJECT_IMAGES_TRANSCODER_COVER_THUMB' => 'bx_persons_cover_thumb',
-        	'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_persons_gallery',
+            'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_persons_gallery',
             'OBJECT_VIEWS' => 'bx_persons',
-        	'OBJECT_SCORES' => 'bx_persons',
-        	'OBJECT_FAVORITES' => 'bx_persons',
-        	'OBJECT_FEATURED' => 'bx_persons',
-        	'OBJECT_COMMENTS' => 'bx_persons',
-        	'OBJECT_REPORTS' => 'bx_persons',
+            'OBJECT_VOTES' => 'bx_persons',
+            'OBJECT_SCORES' => 'bx_persons',
+            'OBJECT_FAVORITES' => 'bx_persons',
+            'OBJECT_FEATURED' => 'bx_persons',
+            'OBJECT_COMMENTS' => 'bx_persons',
+            'OBJECT_REPORTS' => 'bx_persons',
             'OBJECT_METATAGS' => 'bx_persons',
             'OBJECT_FORM_ENTRY' => 'bx_person',
             'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_person_view',
-        	'OBJECT_FORM_ENTRY_DISPLAY_VIEW_FULL' => 'bx_person_view_full', // for "info" tab on view profile page 
+            'OBJECT_FORM_ENTRY_DISPLAY_VIEW_FULL' => 'bx_person_view_full', // for "info" tab on view profile page 
             'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_person_add',
             'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_person_edit',
             'OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER' => 'bx_person_edit_cover',
@@ -124,7 +125,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'OBJECT_UPLOADERS_COVER' => array('bx_persons_cover_crop'),
             'OBJECT_UPLOADERS_PICTURE' => array('bx_persons_picture_crop'),
 
-        	'EMAIL_FRIEND_REQUEST' => 'bx_persons_friend_request',
+            'EMAIL_FRIEND_REQUEST' => 'bx_persons_friend_request',
 
             'TRIGGER_MENU_PROFILE_VIEW_SUBMENU' => 'trigger_profile_view_submenu',
             'TRIGGER_MENU_PROFILE_SNIPPET_META' => 'trigger_profile_snippet_meta',
@@ -161,6 +162,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'T' => array (
                 'txt_sample_single' => '_bx_persons_txt_sample_single',
             	'txt_sample_comment_single' => '_bx_persons_txt_sample_comment_single',
+                'txt_sample_vote_single' => '_bx_persons_txt_sample_vote_single',
             	'txt_sample_pp_single' => '_bx_persons_txt_sample_pp_single',
             	'txt_sample_pp_single_with_article' => '_bx_persons_txt_sample_pp_single_with_article',
                 'txt_sample_pc_single' => '_bx_persons_txt_sample_pc_single',

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

@@ -274,13 +274,13 @@
     <string name="_bx_persons_txt_ntfs_timeline_post_common"><![CDATA[New post <b class="bx-ntfs-content-entry">{subentry_sample}</b> in <b class="bx-ntfs-content-profile">{owner_name}</b> profile timeline]]></string>
     <string name="_bx_persons_txt_sample_single"><![CDATA[person]]></string>
     <string name="_bx_persons_txt_sample_comment_single"><![CDATA[comment to person]]></string>
+    <string name="_bx_persons_txt_sample_vote_single"><![CDATA[vote to person]]></string>
     <string name="_bx_persons_txt_sample_pp_single"><![CDATA[profile picture]]></string>
     <string name="_bx_persons_txt_sample_pp_single_with_article"><![CDATA[a profile picture]]></string>
     <string name="_bx_persons_txt_sample_pc_single"><![CDATA[profile cover]]></string>
     <string name="_bx_persons_txt_sample_pc_single_with_article"><![CDATA[a profile cover]]></string>
     <string name="_bx_persons_txt_sample_pi_action"><![CDATA[changed {0}]]></string>
     <string name="_bx_persons_txt_sample_pi_action_user"><![CDATA[{0} changed {1}]]></string>
-    
 
     <string name="_bx_persons_email_friend_request"><![CDATA[Friend request]]></string>
     <string name="_bx_persons_email_friend_request_subject"><![CDATA[Friendship Request]]></string>

+ 3 - 0
modules/boonex/persons/install/sql/disable.sql

@@ -28,6 +28,9 @@ DELETE FROM `sys_objects_cmts` WHERE `Name` = 'bx_persons';
 -- VIEWS
 DELETE FROM `sys_objects_view` WHERE `name` = 'bx_persons';
 
+-- VOTES
+DELETE FROM `sys_objects_vote` WHERE `Name` = 'bx_persons';
+
 -- SCORES
 DELETE FROM `sys_objects_score` WHERE `name` = 'bx_persons';
 

+ 5 - 0
modules/boonex/persons/install/sql/enable.sql

@@ -257,6 +257,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_persons_view_actions_all', 'bx_persons', 'profile-set-acl-level', '_sys_menu_item_title_system_set_acl_level', '', '', '', '', '', '', '', 0, 192, 1, 0, 50),
 ('bx_persons_view_actions_all', 'bx_persons', 'comment', '_sys_menu_item_title_system_va_comment', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 200),
 ('bx_persons_view_actions_all', 'bx_persons', 'view', '_sys_menu_item_title_system_va_view', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 210),
+('bx_persons_view_actions_all', 'bx_persons', 'vote', '_sys_menu_item_title_system_va_vote', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 215),
 ('bx_persons_view_actions_all', 'bx_persons', 'score', '_sys_menu_item_title_system_va_score', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 220),
 ('bx_persons_view_actions_all', 'bx_persons', 'favorite', '_sys_menu_item_title_system_va_favorite', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 230),
 ('bx_persons_view_actions_all', 'bx_persons', 'feature', '_sys_menu_item_title_system_va_feature', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 240),
@@ -422,6 +423,10 @@ INSERT INTO `sys_objects_cmts` (`Name`, `Module`, `Table`, `CharsPostMin`, `Char
 INSERT INTO `sys_objects_view` (`name`, `module`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
 ('bx_persons', 'bx_persons', 'bx_persons_views_track', '86400', '1', 'bx_persons_data', 'id', 'author', 'views', '', '');
 
+-- VOTES
+INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 
+('bx_persons', 'bx_persons_votes', 'bx_persons_votes_track', '604800', '1', '1', '0', '1', 'bx_persons_data', 'id', 'author', 'rate', 'votes', '', '');
+
 -- 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 
 ('bx_persons', 'bx_persons', 'bx_persons_scores', 'bx_persons_scores_track', '604800', '0', 'bx_persons_data', 'id', 'author', 'score', 'sc_up', 'sc_down', '', '');

+ 21 - 0
modules/boonex/persons/install/sql/install.sql

@@ -14,6 +14,8 @@ CREATE TABLE IF NOT EXISTS `bx_persons_data` (
   `gender` varchar(255) DEFAULT NULL,
   `birthday` date DEFAULT NULL,
   `views` int(11) NOT NULL default '0',
+  `rate` float NOT NULL default '0',
+  `votes` 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',
@@ -87,6 +89,25 @@ CREATE TABLE IF NOT EXISTS `bx_persons_views_track` (
   KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
 );
 
+-- TABLE: VOTES
+CREATE TABLE IF NOT EXISTS `bx_persons_votes` (
+  `object_id` int(11) NOT NULL default '0',
+  `count` int(11) NOT NULL default '0',
+  `sum` int(11) NOT NULL default '0',
+  UNIQUE KEY `object_id` (`object_id`)
+);
+
+CREATE TABLE IF NOT EXISTS `bx_persons_votes_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',
+  `value` tinyint(4) NOT NULL default '0',
+  `date` int(11) NOT NULL default '0',
+  PRIMARY KEY (`id`),
+  KEY `vote` (`object_id`, `author_nip`)
+);
+
 -- TABLE: favorites
 CREATE TABLE IF NOT EXISTS `bx_persons_favorites_track` (
   `object_id` int(11) NOT NULL default '0',

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

@@ -1,6 +1,6 @@
 
 -- TABLES
-DROP TABLE IF EXISTS `bx_persons_data`,`bx_persons_pictures`, `bx_persons_pictures_resized`, `bx_persons_cmts`, `bx_persons_views_track`, `bx_persons_favorites_track`, `bx_persons_reports`, `bx_persons_reports_track`, `bx_persons_meta_keywords`, `bx_persons_meta_locations`, `bx_persons_meta_mentions`, `bx_persons_scores`, `bx_persons_scores_track`;
+DROP TABLE IF EXISTS `bx_persons_data`,`bx_persons_pictures`, `bx_persons_pictures_resized`, `bx_persons_cmts`, `bx_persons_views_track`, `bx_persons_votes`, `bx_persons_votes_track`, `bx_persons_favorites_track`, `bx_persons_reports`, `bx_persons_reports_track`, `bx_persons_meta_keywords`, `bx_persons_meta_locations`, `bx_persons_meta_mentions`, `bx_persons_scores`, `bx_persons_scores_track`;
 
 -- PROFILES
 DELETE FROM sys_profiles WHERE `type` = 'bx_persons';

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

@@ -275,6 +275,7 @@
     <string name="_bx_persons_txt_ntfs_timeline_post_common"><![CDATA[В профайле <b class="bx-ntfs-content-profile">{owner_name}</b> новая публикация <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
     <string name="_bx_persons_txt_sample_single"><![CDATA[Персона]]></string>
     <string name="_bx_persons_txt_sample_comment_single"><![CDATA[комментарий к персональному профилю]]></string>
+    <string name="_bx_persons_txt_sample_vote_single"><![CDATA[голос за профиль]]></string>
     <string name="_bx_persons_txt_sample_pp_single"><![CDATA[изображение профиля]]></string>
     <string name="_bx_persons_txt_sample_pp_single_with_article"><![CDATA[изображение профиля]]></string>
     <string name="_bx_persons_txt_sample_pc_single"><![CDATA[обложка профиля]]></string>