install.sql 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
  2. -- TABLE: PROFILES
  3. CREATE TABLE IF NOT EXISTS `bx_workspaces_data` (
  4. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  5. `author` int(10) unsigned NOT NULL,
  6. `added` int(11) NOT NULL,
  7. `changed` int(11) NOT NULL,
  8. `views` int(11) NOT NULL default '0',
  9. `rate` float NOT NULL default '0',
  10. `votes` int(11) NOT NULL default '0',
  11. `rrate` float NOT NULL default '0',
  12. `rvotes` int(11) NOT NULL default '0',
  13. `score` int(11) NOT NULL default '0',
  14. `sc_up` int(11) NOT NULL default '0',
  15. `sc_down` int(11) NOT NULL default '0',
  16. `favorites` int(11) NOT NULL default '0',
  17. `comments` int(11) NOT NULL default '0',
  18. `reports` int(11) NOT NULL default '0',
  19. `featured` int(11) NOT NULL default '0',
  20. `allow_view_to` varchar(16) NOT NULL DEFAULT '3',
  21. `allow_post_to` varchar(16) NOT NULL DEFAULT '5',
  22. `allow_contact_to` varchar(16) NOT NULL DEFAULT '3',
  23. `settings` text NOT NULL,
  24. PRIMARY KEY (`id`)
  25. );
  26. -- TABLE: VIEWS
  27. CREATE TABLE IF NOT EXISTS `bx_workspaces_views_track` (
  28. `id` int(11) NOT NULL AUTO_INCREMENT,
  29. `object_id` int(11) NOT NULL default '0',
  30. `viewer_id` int(11) NOT NULL default '0',
  31. `viewer_nip` int(11) unsigned NOT NULL default '0',
  32. `date` int(11) NOT NULL default '0',
  33. PRIMARY KEY (`id`),
  34. KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
  35. );
  36. -- TABLE: VOTES
  37. CREATE TABLE IF NOT EXISTS `bx_workspaces_votes` (
  38. `id` int(11) NOT NULL AUTO_INCREMENT,
  39. `object_id` int(11) NOT NULL default '0',
  40. `count` int(11) NOT NULL default '0',
  41. `sum` int(11) NOT NULL default '0',
  42. PRIMARY KEY (`id`),
  43. UNIQUE KEY `object_id` (`object_id`)
  44. );
  45. CREATE TABLE IF NOT EXISTS `bx_workspaces_votes_track` (
  46. `id` int(11) NOT NULL AUTO_INCREMENT,
  47. `object_id` int(11) NOT NULL default '0',
  48. `author_id` int(11) NOT NULL default '0',
  49. `author_nip` int(11) unsigned NOT NULL default '0',
  50. `value` tinyint(4) NOT NULL default '0',
  51. `date` int(11) NOT NULL default '0',
  52. PRIMARY KEY (`id`),
  53. KEY `vote` (`object_id`, `author_nip`)
  54. );
  55. CREATE TABLE IF NOT EXISTS `bx_workspaces_reactions` (
  56. `id` int(11) NOT NULL AUTO_INCREMENT,
  57. `object_id` int(11) NOT NULL default '0',
  58. `reaction` varchar(32) NOT NULL default '',
  59. `count` int(11) NOT NULL default '0',
  60. `sum` int(11) NOT NULL default '0',
  61. PRIMARY KEY (`id`),
  62. UNIQUE KEY `reaction` (`object_id`, `reaction`)
  63. );
  64. CREATE TABLE IF NOT EXISTS `bx_workspaces_reactions_track` (
  65. `id` int(11) NOT NULL AUTO_INCREMENT,
  66. `object_id` int(11) NOT NULL default '0',
  67. `author_id` int(11) NOT NULL default '0',
  68. `author_nip` int(11) unsigned NOT NULL default '0',
  69. `reaction` varchar(32) NOT NULL default '',
  70. `value` tinyint(4) NOT NULL default '0',
  71. `date` int(11) NOT NULL default '0',
  72. PRIMARY KEY (`id`),
  73. KEY `vote` (`object_id`, `author_nip`)
  74. );
  75. -- TABLE: favorites
  76. CREATE TABLE IF NOT EXISTS `bx_workspaces_favorites_track` (
  77. `id` int(11) NOT NULL AUTO_INCREMENT,
  78. `object_id` int(11) NOT NULL default '0',
  79. `author_id` int(11) NOT NULL default '0',
  80. `date` int(11) NOT NULL default '0',
  81. PRIMARY KEY (`id`),
  82. KEY `id` (`object_id`,`author_id`)
  83. );
  84. -- TABLE: reports
  85. CREATE TABLE IF NOT EXISTS `bx_workspaces_reports` (
  86. `id` int(11) NOT NULL AUTO_INCREMENT,
  87. `object_id` int(11) NOT NULL default '0',
  88. `count` int(11) NOT NULL default '0',
  89. PRIMARY KEY (`id`),
  90. UNIQUE KEY `object_id` (`object_id`)
  91. );
  92. CREATE TABLE IF NOT EXISTS `bx_workspaces_reports_track` (
  93. `id` int(11) NOT NULL AUTO_INCREMENT,
  94. `object_id` int(11) NOT NULL default '0',
  95. `author_id` int(11) NOT NULL default '0',
  96. `author_nip` int(11) unsigned NOT NULL default '0',
  97. `type` varchar(32) NOT NULL default '',
  98. `text` text NOT NULL default '',
  99. `date` int(11) NOT NULL default '0',
  100. `checked_by` int(11) NOT NULL default '0',
  101. `status` tinyint(11) NOT NULL default '0',
  102. PRIMARY KEY (`id`),
  103. KEY `report` (`object_id`, `author_nip`)
  104. );
  105. -- TABLE: scores
  106. CREATE TABLE IF NOT EXISTS `bx_workspaces_scores` (
  107. `id` int(11) NOT NULL AUTO_INCREMENT,
  108. `object_id` int(11) NOT NULL default '0',
  109. `count_up` int(11) NOT NULL default '0',
  110. `count_down` int(11) NOT NULL default '0',
  111. PRIMARY KEY (`id`),
  112. UNIQUE KEY `object_id` (`object_id`)
  113. );
  114. CREATE TABLE IF NOT EXISTS `bx_workspaces_scores_track` (
  115. `id` int(11) NOT NULL AUTO_INCREMENT,
  116. `object_id` int(11) NOT NULL default '0',
  117. `author_id` int(11) NOT NULL default '0',
  118. `author_nip` int(11) unsigned NOT NULL default '0',
  119. `type` varchar(8) NOT NULL default '',
  120. `date` int(11) NOT NULL default '0',
  121. PRIMARY KEY (`id`),
  122. KEY `vote` (`object_id`, `author_nip`)
  123. );
  124. -- FORMS
  125. INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`, `parent_form`) VALUES
  126. ('bx_workspace', 'bx_workspaces', '_bx_workspaces_form_profile', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_workspaces_data', 'id', '', '', 'do_submit', '', 0, 1, 'BxWorkspacesFormEntry', 'modules/boonex/workspaces/classes/BxWorkspacesFormEntry.php', '');
  127. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  128. ('bx_workspace', 'bx_workspace_add', 'bx_workspaces', 0, '_bx_workspaces_form_profile_display_add'),
  129. ('bx_workspace', 'bx_workspace_delete', 'bx_workspaces', 0, '_bx_workspaces_form_profile_display_delete'),
  130. ('bx_workspace', 'bx_workspace_edit', 'bx_workspaces', 0, '_bx_workspaces_form_profile_display_edit'),
  131. ('bx_workspace', 'bx_workspace_view', 'bx_workspaces', 1, '_bx_workspaces_form_profile_display_view'),
  132. ('bx_workspace', 'bx_workspace_view_full', 'bx_workspaces', 1, '_bx_workspaces_form_profile_display_view_full');
  133. INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`, `rateable`) VALUES
  134. ('bx_workspace', 'bx_workspaces', 'allow_view_to', 3, '', 0, 'custom', '_bx_workspaces_form_profile_input_sys_allow_view_to', '_bx_workspaces_form_profile_input_allow_view_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
  135. ('bx_workspace', 'bx_workspaces', 'allow_post_to', 5, '', 0, 'custom', '_bx_workspaces_form_profile_input_sys_allow_post_to', '_bx_workspaces_form_profile_input_allow_post_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
  136. ('bx_workspace', 'bx_workspaces', 'allow_contact_to', 3, '', 0, 'custom', '_bx_workspaces_form_profile_input_sys_allow_contact_to', '_bx_workspaces_form_profile_input_allow_contact_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
  137. ('bx_workspace', 'bx_workspaces', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_workspaces_form_profile_input_sys_delete_confirm', '_bx_workspaces_form_profile_input_delete_confirm', '_bx_workspaces_form_profile_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_workspaces_form_profile_input_delete_confirm_error', '', '', 1, 0, ''),
  138. ('bx_workspace', 'bx_workspaces', 'do_submit', '_bx_workspaces_form_profile_input_submit', '', 0, 'submit', '_bx_workspaces_form_profile_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
  139. ('bx_workspace', 'bx_workspaces', 'do_cancel', '_sys_form_input_cancel', '', 0, 'button', '_sys_form_input_sys_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:41:"window.open(''{edit_cancel_url}'', ''_self'')";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 0, 0, ''),
  140. ('bx_workspace', 'bx_workspaces', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '_sys_form_input_sys_controls', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0, ''),
  141. ('bx_workspace', 'bx_workspaces', 'profile_email', '', '', 0, 'text', '_bx_workspaces_form_profile_input_sys_profile_email', '_bx_workspaces_form_profile_input_profile_email', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0, ''),
  142. ('bx_workspace', 'bx_workspaces', 'profile_status', '', '', 0, 'text', '_bx_workspaces_form_profile_input_sys_profile_status', '_bx_workspaces_form_profile_input_profile_status', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0, ''),
  143. ('bx_workspace', 'bx_workspaces', 'profile_ip', '', '', 0, 'text', '_bx_workspaces_form_profile_input_sys_profile_ip', '_bx_workspaces_form_profile_input_profile_ip', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0, ''),
  144. ('bx_workspace', 'bx_workspaces', 'profile_last_active', '', '', 0, 'text', '_bx_workspaces_form_profile_input_sys_profile_last_active', '_bx_workspaces_form_profile_input_profile_last_active', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0, ''),
  145. ('bx_workspace', 'bx_workspaces', 'added', '', '', 0, 'datetime', '_bx_workspaces_form_profile_input_sys_date_added', '_bx_workspaces_form_profile_input_date_added', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
  146. ('bx_workspace', 'bx_workspaces', 'changed', '', '', 0, 'datetime', '_bx_workspaces_form_profile_input_sys_date_changed', '_bx_workspaces_form_profile_input_date_changed', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
  147. ('bx_workspace', 'bx_workspaces', 'friends_count', '', '', 0, 'text', '_bx_workspaces_form_profile_input_sys_friends_count', '_bx_workspaces_form_profile_input_friends_count', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
  148. ('bx_workspace', 'bx_workspaces', 'followers_count', '', '', 0, 'text', '_bx_workspaces_form_profile_input_sys_followers_count', '_bx_workspaces_form_profile_input_followers_count', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, '');
  149. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  150. ('bx_workspace_add', 'allow_view_to', 2147483647, 1, 8),
  151. ('bx_workspace_add', 'allow_post_to', 2147483647, 1, 9),
  152. ('bx_workspace_add', 'allow_contact_to', 2147483647, 1, 10),
  153. ('bx_workspace_add', 'do_submit', 2147483647, 1, 11),
  154. ('bx_workspace_delete', 'delete_confirm', 2147483647, 1, 0),
  155. ('bx_workspace_delete', 'do_submit', 2147483647, 1, 1),
  156. ('bx_workspace_edit', 'allow_view_to', 2147483647, 1, 8),
  157. ('bx_workspace_edit', 'allow_post_to', 2147483647, 1, 9),
  158. ('bx_workspace_edit', 'allow_contact_to', 2147483647, 1, 10),
  159. ('bx_workspace_edit', 'controls', 2147483647, 1, 11),
  160. ('bx_workspace_edit', 'do_submit', 2147483647, 1, 12),
  161. ('bx_workspace_edit', 'do_cancel', 2147483647, 1, 13),
  162. ('bx_workspace_view', 'profile_email', 192, 1, 5),
  163. ('bx_workspace_view', 'profile_status', 192, 1, 6),
  164. ('bx_workspace_view', 'profile_ip', 192, 1, 7),
  165. ('bx_workspace_view', 'profile_last_active', 192, 1, 8),
  166. ('bx_workspace_view', 'added', 192, 1, 9),
  167. ('bx_workspace_view', 'changed', 192, 1, 10),
  168. ('bx_workspace_view', 'friends_count', 2147483647, 1, 11),
  169. ('bx_workspace_view', 'followers_count', 2147483647, 1, 12),
  170. ('bx_workspace_view_full', 'profile_email', 192, 1, 6),
  171. ('bx_workspace_view_full', 'profile_status', 192, 1, 7),
  172. ('bx_workspace_view_full', 'profile_last_active', 192, 1, 8);
  173. -- COMMENTS
  174. INSERT INTO `sys_objects_cmts` (`Name`, `Module`, `Table`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Html`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `BaseUrl`, `ObjectVote`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldTitle`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
  175. ('bx_workspaces', 'bx_workspaces', 'bx_workspaces_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-workspaces-profile&id={object_id}', '', 'bx_workspaces_data', 'id', 'author', 'fullname', 'comments', 'BxWorkspacesCmts', 'modules/boonex/workspaces/classes/BxWorkspacesCmts.php'),
  176. ('bx_workspaces_notes', 'bx_workspaces', 'bx_workspaces_cmts_notes', 1, 5000, 1000, 0, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-post&id={object_id}', '', 'bx_workspaces_data', 'id', 'author', 'fullname', '', 'BxTemplCmtsNotes', '');
  177. -- VIEWS
  178. 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
  179. ('bx_workspaces', 'bx_workspaces', 'bx_workspaces_views_track', '86400', '1', 'bx_workspaces_data', 'id', 'author', 'views', '', '');
  180. -- VOTES
  181. INSERT INTO `sys_objects_vote` (`Name`, `Module`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES
  182. ('bx_workspaces', 'bx_workspaces', 'bx_workspaces_votes', 'bx_workspaces_votes_track', '604800', '1', '1', '0', '1', 'bx_workspaces_data', 'id', '', 'rate', 'votes', 'BxWorkspacesVote', 'modules/boonex/workspaces/classes/BxWorkspacesVote.php'),
  183. ('bx_workspaces_reactions', 'bx_workspaces', 'bx_workspaces_reactions', 'bx_workspaces_reactions_track', '604800', '1', '1', '1', '1', 'bx_workspaces_data', 'id', 'author', 'rrate', 'rvotes', 'BxTemplVoteReactions', '');
  184. -- SCORES
  185. 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
  186. ('bx_workspaces', 'bx_workspaces', 'bx_workspaces_scores', 'bx_workspaces_scores_track', '604800', '1', 'bx_workspaces_data', 'id', 'author', 'score', 'sc_up', 'sc_down', '', '');
  187. -- FAFORITES
  188. 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
  189. ('bx_workspaces', 'bx_workspaces_favorites_track', '1', '1', '0', 'page.php?i=view-workspaces-profile&id={object_id}', 'bx_workspaces_data', 'id', 'author', 'favorites', 'BxWorkspacesFavorite', 'modules/boonex/workspaces/classes/BxWorkspacesFavorite.php');
  190. -- FEATURED
  191. INSERT INTO `sys_objects_feature` (`name`, `module`, `is_on`, `is_undo`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_flag`, `class_name`, `class_file`) VALUES
  192. ('bx_workspaces', 'bx_workspaces', '1', '1', 'page.php?i=view-workspaces-profile&id={object_id}', 'bx_workspaces_data', 'id', 'author', 'featured', '', '');
  193. -- REPORTS
  194. INSERT INTO `sys_objects_report` (`name`, `module`, `table_main`, `table_track`, `is_on`, `base_url`, `object_comment`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES
  195. ('bx_workspaces', 'bx_workspaces', 'bx_workspaces_reports', 'bx_workspaces_reports_track', '1', 'page.php?i=view-workspaces-profile&id={object_id}', 'bx_workspaces_notes', 'bx_workspaces_data', 'id', 'author', 'reports', 'BxWorkspacesReport', 'modules/boonex/workspaces/classes/BxWorkspacesReport.php');
  196. -- CONTENT INFO
  197. INSERT INTO `sys_objects_content_info` (`name`, `title`, `alert_unit`, `alert_action_add`, `alert_action_update`, `alert_action_delete`, `class_name`, `class_file`) VALUES
  198. ('bx_workspaces', '_bx_workspaces', 'bx_workspaces', 'added', 'edited', 'deleted', '', ''),
  199. ('bx_workspaces_cmts', '_bx_workspaces_cmts', 'bx_workspaces', 'commentPost', 'commentUpdated', 'commentRemoved', 'BxDolContentInfoCmts', '');
  200. INSERT INTO `sys_content_info_grids` (`object`, `grid_object`, `grid_field_id`, `condition`, `selection`) VALUES
  201. ('bx_workspaces', 'bx_workspaces_administration', 'td`.`id', '', ''),
  202. ('bx_workspaces', 'bx_workspaces_common', 'td`.`id', '', '');
  203. -- STUDIO PAGE & WIDGET
  204. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  205. (3, 'bx_workspaces', '_bx_workspaces', '_bx_workspaces', 'bx_workspaces@modules/boonex/workspaces/|std-icon.svg');
  206. SET @iPageId = LAST_INSERT_ID();
  207. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  208. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  209. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  210. (@iPageId, 'bx_workspaces', 'users', '{url_studio}module.php?name=bx_workspaces', '', 'bx_workspaces@modules/boonex/workspaces/|std-icon.svg', '_bx_workspaces', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}');
  211. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  212. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));