install.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
  2. -- TABLE: entries
  3. CREATE TABLE IF NOT EXISTS `bx_convos_conversations` (
  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. `text` text NOT NULL,
  9. `allow_edit` tinyint(4) NOT NULL DEFAULT '0',
  10. `views` int(11) NOT NULL default '0',
  11. `comments` int(11) NOT NULL default '0',
  12. `last_reply_timestamp` int(11) NOT NULL,
  13. `last_reply_profile_id` int(10) unsigned NOT NULL,
  14. `last_reply_comment_id` int(11) NOT NULL,
  15. PRIMARY KEY (`id`),
  16. KEY `last_reply_timestamp` (`last_reply_timestamp`)
  17. );
  18. CREATE TABLE IF NOT EXISTS `bx_convos_conv2folder` (
  19. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  20. `conv_id` int(10) unsigned NOT NULL,
  21. `folder_id` int(10) unsigned NOT NULL,
  22. `collaborator` int(10) unsigned NOT NULL,
  23. `read_comments` int(11) NOT NULL default '-1',
  24. PRIMARY KEY (`id`),
  25. UNIQUE KEY `collaborator_folder_conv` (`collaborator`,`folder_id`, `conv_id`),
  26. KEY `conv_id` (`conv_id`)
  27. );
  28. CREATE TABLE IF NOT EXISTS `bx_convos_folders` (
  29. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  30. `author` int(10) unsigned NOT NULL,
  31. `name` varchar(255) NOT NULL DEFAULT '',
  32. PRIMARY KEY (`id`),
  33. KEY `author` (`author`)
  34. );
  35. INSERT INTO `bx_convos_folders` (`id`, `author`, `name`) VALUES
  36. (1, 0, '_bx_cnv_folder_inbox'),
  37. (2, 0, '_bx_cnv_folder_drafts'),
  38. (3, 0, '_bx_cnv_folder_spam'),
  39. (4, 0, '_bx_cnv_folder_trash');
  40. -- TABLE: storages & transcoders
  41. CREATE TABLE IF NOT EXISTS `bx_convos_files` (
  42. `id` int(11) NOT NULL AUTO_INCREMENT,
  43. `profile_id` int(10) unsigned NOT NULL,
  44. `remote_id` varchar(128) NOT NULL,
  45. `path` varchar(255) NOT NULL,
  46. `file_name` varchar(255) NOT NULL,
  47. `mime_type` varchar(128) NOT NULL,
  48. `ext` varchar(32) NOT NULL,
  49. `size` bigint(20) NOT NULL,
  50. `added` int(11) NOT NULL,
  51. `modified` int(11) NOT NULL,
  52. `private` int(11) NOT NULL,
  53. PRIMARY KEY (`id`),
  54. UNIQUE KEY `remote_id` (`remote_id`)
  55. );
  56. CREATE TABLE IF NOT EXISTS `bx_convos_photos_resized` (
  57. `id` int(11) NOT NULL AUTO_INCREMENT,
  58. `profile_id` int(10) unsigned NOT NULL,
  59. `remote_id` varchar(128) NOT NULL,
  60. `path` varchar(255) NOT NULL,
  61. `file_name` varchar(255) NOT NULL,
  62. `mime_type` varchar(128) NOT NULL,
  63. `ext` varchar(32) NOT NULL,
  64. `size` bigint(20) NOT NULL,
  65. `added` int(11) NOT NULL,
  66. `modified` int(11) NOT NULL,
  67. `private` int(11) NOT NULL,
  68. PRIMARY KEY (`id`),
  69. UNIQUE KEY `remote_id` (`remote_id`)
  70. );
  71. -- TABLE: comments
  72. CREATE TABLE IF NOT EXISTS `bx_convos_cmts` (
  73. `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
  74. `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
  75. `cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
  76. `cmt_object_id` int(11) NOT NULL DEFAULT '0',
  77. `cmt_author_id` int(11) NOT NULL DEFAULT '0',
  78. `cmt_level` int(11) NOT NULL DEFAULT '0',
  79. `cmt_text` text NOT NULL,
  80. `cmt_mood` tinyint(4) NOT NULL DEFAULT '0',
  81. `cmt_rate` int(11) NOT NULL DEFAULT '0',
  82. `cmt_rate_count` int(11) NOT NULL DEFAULT '0',
  83. `cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
  84. `cmt_replies` int(11) NOT NULL DEFAULT '0',
  85. `cmt_pinned` int(11) NOT NULL default '0',
  86. PRIMARY KEY (`cmt_id`),
  87. KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`),
  88. FULLTEXT KEY `search_fields` (`cmt_text`)
  89. );
  90. -- TABLE: views
  91. CREATE TABLE `bx_convos_views_track` (
  92. `object_id` int(11) NOT NULL default '0',
  93. `viewer_id` int(11) NOT NULL default '0',
  94. `viewer_nip` int(11) unsigned NOT NULL default '0',
  95. `date` int(11) NOT NULL default '0',
  96. KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
  97. );
  98. -- STORAGES & TRANSCODERS
  99. 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
  100. ('bx_convos_files', @sStorageEngine, '', 360, 2592000, 3, 'bx_convos_files', 'deny-allow', '', 'action,apk,app,bat,bin,cmd,com,command,cpl,csh,exe,gadget,inf,ins,inx,ipa,isu,job,jse,ksh,lnk,msc,msi,msp,mst,osx,out,paf,pif,prg,ps1,reg,rgs,run,sct,shb,shs,u3p,vb,vbe,vbs,vbscript,workflow,ws,wsf', 0, 0, 0, 0, 0, 0),
  101. ('bx_convos_photos_resized', @sStorageEngine, '', 360, 2592000, 3, 'bx_convos_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
  102. INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
  103. ('bx_convos_preview', 'bx_convos_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_convos_files";}', 'no', '1', '2592000', '0');
  104. INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
  105. ('bx_convos_preview', 'Resize', 'a:3:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";}', '0');
  106. -- FORMS
  107. 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`) VALUES
  108. ('bx_convos', 'bx_convos', '_bx_cnv_form_entry', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_convos_conversations', 'id', '', '', 'do_submit', 'a:1:{s:14:"checker_helper";s:27:"BxCnvFormEntryCheckerHelper";}', 0, 1, 'BxCnvFormEntry', 'modules/boonex/convos/classes/BxCnvFormEntry.php');
  109. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  110. ('bx_convos', 'bx_convos_entry_add', 'bx_convos', 0, '_bx_cnv_form_entry_display_add'),
  111. ('bx_convos', 'bx_convos_entry_edit', 'bx_convos', 0, '_bx_cnv_form_entry_display_edit'),
  112. ('bx_convos', 'bx_convos_entry_delete', 'bx_convos', 0, '_bx_cnv_form_entry_display_delete'),
  113. ('bx_convos', 'bx_convos_entry_view', 'bx_convos', 1, '_bx_cnv_form_entry_display_view');
  114. 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`) VALUES
  115. ('bx_convos', 'bx_convos', 'allow_edit', 1, '', 0, 'switcher', '_bx_cnv_form_entry_input_sys_allow_edit', '_bx_cnv_form_entry_input_allow_edit', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
  116. ('bx_convos', 'bx_convos', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_cnv_form_entry_input_sys_delete_confirm', '_bx_cnv_form_entry_input_delete_confirm', '_bx_cnv_form_entry_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_cnv_form_entry_input_delete_confirm_error', '', '', 1, 0),
  117. ('bx_convos', 'bx_convos', 'do_submit', '_bx_cnv_form_entry_input_do_submit', '', 0, 'submit', '_bx_cnv_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  118. ('bx_convos', 'bx_convos', 'submit_text', '', '', 0, 'custom', '_bx_cnv_form_entry_input_sys_submit_text', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  119. ('bx_convos', 'bx_convos', 'submit_block', '', 'do_submit,submit_text', 0, 'input_set', '_bx_cnv_form_entry_input_sys_submit_block', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  120. ('bx_convos', 'bx_convos', 'draft_id', '0', '', 0, 'hidden', '_bx_cnv_form_entry_input_sys_draft_id', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  121. ('bx_convos', 'bx_convos', 'text', '', '', 0, 'textarea', '_bx_cnv_form_entry_input_sys_text', '_bx_cnv_form_entry_input_text', '', 1, 0, 2, '', '', '', 'Avail', '', '_bx_cnv_form_entry_input_text_err', 'XssHtml', '', 1, 0),
  122. ('bx_convos', 'bx_convos', 'recipients', '', '', 0, 'custom', '_bx_cnv_form_entry_input_sys_recipients', '_bx_cnv_form_entry_input_recipients', '', 1, 0, 0, '', '', '', 'Recipients', '', '_bx_cnv_form_entry_input_recipients_err', '', '', 1, 0),
  123. ('bx_convos', 'bx_convos', 'attachments', 'a:1:{i:0;s:9:"sys_html5";}', 'a:2:{s:10:"sys_simple";s:26:"_sys_uploader_simple_title";s:9:"sys_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_cnv_form_entry_input_sys_attachments', '_bx_cnv_form_entry_input_attachments', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
  124. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  125. ('bx_convos_entry_add', 'delete_confirm', 2147483647, 0, 0),
  126. ('bx_convos_entry_add', 'recipients', 2147483647, 1, 1),
  127. ('bx_convos_entry_add', 'text', 2147483647, 1, 2),
  128. ('bx_convos_entry_add', 'attachments', 2147483647, 1, 3),
  129. ('bx_convos_entry_add', 'allow_edit', 2147483647, 1, 4),
  130. ('bx_convos_entry_add', 'submit_block', 2147483647, 1, 5),
  131. ('bx_convos_entry_add', 'do_submit', 2147483647, 1, 6),
  132. ('bx_convos_entry_add', 'submit_text', 2147483647, 1, 7),
  133. ('bx_convos_entry_add', 'draft_id', 2147483647, 1, 8),
  134. ('bx_convos_entry_edit', 'delete_confirm', 2147483647, 0, 1),
  135. ('bx_convos_entry_edit', 'recipients', 2147483647, 1, 2),
  136. ('bx_convos_entry_edit', 'text', 2147483647, 1, 3),
  137. ('bx_convos_entry_edit', 'attachments', 2147483647, 1, 4),
  138. ('bx_convos_entry_edit', 'allow_edit', 2147483647, 1, 5),
  139. ('bx_convos_entry_edit', 'submit_block', 2147483647, 1, 6),
  140. ('bx_convos_entry_edit', 'do_submit', 2147483647, 1, 7),
  141. ('bx_convos_entry_edit', 'submit_text', 2147483647, 0, 8),
  142. ('bx_convos_entry_edit', 'draft_id', 2147483647, 0, 9),
  143. ('bx_convos_entry_view', 'delete_confirm', 2147483647, 0, 0),
  144. ('bx_convos_entry_view', 'do_submit', 2147483647, 0, 0),
  145. ('bx_convos_entry_view', 'recipients', 2147483647, 0, 0),
  146. ('bx_convos_entry_view', 'text', 2147483647, 0, 0),
  147. ('bx_convos_entry_view', 'attachments', 2147483647, 0, 0),
  148. ('bx_convos_entry_delete', 'delete_confirm', 2147483647, 1, 1),
  149. ('bx_convos_entry_delete', 'do_submit', 2147483647, 1, 2),
  150. ('bx_convos_entry_delete', 'attachments', 2147483647, 0, 0),
  151. ('bx_convos_entry_delete', 'recipients', 2147483647, 0, 0),
  152. ('bx_convos_entry_delete', 'text', 2147483647, 0, 0);
  153. -- COMMENTS
  154. 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
  155. ('bx_convos', 'bx_convos', 'bx_convos_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-convo&id={object_id}', '', 'bx_convos_conversations', 'id', 'author', 'text', 'comments', 'BxCnvCmts', 'modules/boonex/convos/classes/BxCnvCmts.php');
  156. -- VIEWS
  157. INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES
  158. ('bx_convos', 'bx_convos_views_track', '86400', '1', 'bx_convos_conversations', 'id', 'author', 'views', '', '');
  159. -- STUDIO: page & widget
  160. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  161. (3, 'bx_convos', '_bx_cnv', '_bx_cnv', 'bx_convos@modules/boonex/convos/|std-icon.svg');
  162. SET @iPageId = LAST_INSERT_ID();
  163. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  164. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  165. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  166. (@iPageId, 'bx_convos', 'content', '{url_studio}module.php?name=bx_convos', '', 'bx_convos@modules/boonex/convos/|std-icon.svg', '_bx_cnv', '', '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";}');
  167. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  168. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));