install.sql 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. -- TABLE: entries
  2. CREATE TABLE IF NOT EXISTS `bx_messages_conversations` (
  3. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  4. `author` int(10) unsigned NOT NULL,
  5. `added` int(11) NOT NULL,
  6. `changed` int(11) NOT NULL,
  7. `text` text NOT NULL,
  8. `views` int(11) NOT NULL default '0',
  9. `comments` int(11) NOT NULL default '0',
  10. `last_reply_timestamp` int(11) NOT NULL,
  11. `last_reply_profile_id` int(10) unsigned NOT NULL,
  12. PRIMARY KEY (`id`),
  13. KEY `last_reply_timestamp` (`last_reply_timestamp`)
  14. );
  15. CREATE TABLE IF NOT EXISTS `bx_messages_conv2folder` (
  16. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  17. `conv_id` int(10) unsigned NOT NULL,
  18. `folder_id` int(10) unsigned NOT NULL,
  19. `collaborator` int(10) unsigned NOT NULL,
  20. `read_comments` int(11) NOT NULL default '-1',
  21. PRIMARY KEY (`id`),
  22. UNIQUE KEY `collaborator_folder_conv` (`collaborator`,`folder_id`, `conv_id`),
  23. KEY `conv_id` (`conv_id`)
  24. );
  25. CREATE TABLE IF NOT EXISTS `bx_messages_folders` (
  26. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  27. `author` int(10) unsigned NOT NULL,
  28. `name` varchar(255) NOT NULL DEFAULT '',
  29. PRIMARY KEY (`id`),
  30. KEY `author` (`author`)
  31. );
  32. INSERT INTO `bx_messages_folders` (`id`, `author`, `name`) VALUES
  33. (1, 0, '_bx_msg_folder_inbox'),
  34. (2, 0, '_bx_msg_folder_sent'),
  35. (3, 0, '_bx_msg_folder_drafts'),
  36. (4, 0, '_bx_msg_folder_spam'),
  37. (5, 0, '_bx_msg_folder_trash');
  38. -- TABLE: storages & transcoders
  39. CREATE TABLE IF NOT EXISTS `bx_messages_photos` (
  40. `id` int(11) NOT NULL AUTO_INCREMENT,
  41. `profile_id` int(10) unsigned NOT NULL,
  42. `remote_id` varchar(255) NOT NULL,
  43. `path` varchar(255) NOT NULL,
  44. `file_name` varchar(255) NOT NULL,
  45. `mime_type` varchar(128) NOT NULL,
  46. `ext` varchar(32) NOT NULL,
  47. `size` int(11) NOT NULL,
  48. `added` int(11) NOT NULL,
  49. `modified` int(11) NOT NULL,
  50. `private` int(11) NOT NULL,
  51. PRIMARY KEY (`id`),
  52. UNIQUE KEY `remote_id` (`remote_id`)
  53. );
  54. CREATE TABLE IF NOT EXISTS `bx_messages_photos_resized` (
  55. `id` int(11) NOT NULL AUTO_INCREMENT,
  56. `profile_id` int(10) unsigned NOT NULL,
  57. `remote_id` varchar(255) NOT NULL,
  58. `path` varchar(255) NOT NULL,
  59. `file_name` varchar(255) NOT NULL,
  60. `mime_type` varchar(128) NOT NULL,
  61. `ext` varchar(32) NOT NULL,
  62. `size` int(11) NOT NULL,
  63. `added` int(11) NOT NULL,
  64. `modified` int(11) NOT NULL,
  65. `private` int(11) NOT NULL,
  66. PRIMARY KEY (`id`),
  67. UNIQUE KEY `remote_id` (`remote_id`)
  68. );
  69. -- TABLE: comments
  70. CREATE TABLE IF NOT EXISTS `bx_messages_cmts` (
  71. `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
  72. `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
  73. `cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
  74. `cmt_object_id` int(11) NOT NULL DEFAULT '0',
  75. `cmt_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  76. `cmt_level` int(11) NOT NULL DEFAULT '0',
  77. `cmt_text` text NOT NULL,
  78. `cmt_mood` tinyint(4) NOT NULL DEFAULT '0',
  79. `cmt_rate` int(11) NOT NULL DEFAULT '0',
  80. `cmt_rate_count` int(11) NOT NULL DEFAULT '0',
  81. `cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
  82. `cmt_replies` int(11) NOT NULL DEFAULT '0',
  83. PRIMARY KEY (`cmt_id`),
  84. KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
  85. );
  86. -- TABLE: views
  87. CREATE TABLE `bx_messages_views_track` (
  88. `object_id` int(11) NOT NULL default '0',
  89. `viewer_id` int(11) NOT NULL default '0',
  90. `viewer_nip` int(11) unsigned NOT NULL default '0',
  91. `date` int(11) NOT NULL default '0',
  92. KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
  93. );
  94. -- FORMS
  95. 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
  96. ('bx_messages', 'bx_messages', '_bx_msg_form_entry', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_messages_conversations', 'id', '', '', 'do_submit', '', 0, 1, 'BxMsgFormEntry', 'modules/boonex/messages/classes/BxMsgFormEntry.php');
  97. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  98. ('bx_messages', 'bx_messages_entry_add', 'bx_messages', 0, '_bx_msg_form_entry_display_add'),
  99. ('bx_messages', 'bx_messages_entry_delete', 'bx_messages', 0, '_bx_msg_form_entry_display_delete'),
  100. ('bx_messages', 'bx_messages_entry_view', 'bx_messages', 1, '_bx_msg_form_entry_display_view');
  101. 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
  102. ('bx_messages', 'bx_messages', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_msg_form_entry_input_sys_delete_confirm', '_bx_msg_form_entry_input_delete_confirm', '_bx_msg_form_entry_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_msg_form_entry_input_delete_confirm_error', '', '', 1, 0),
  103. ('bx_messages', 'bx_messages', 'do_submit', '_bx_msg_form_entry_input_do_submit', '', 0, 'submit', '_bx_msg_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  104. ('bx_messages', 'bx_messages', 'text', '', '', 0, 'textarea', '_bx_msg_form_entry_input_sys_text', '_bx_msg_form_entry_input_text', '', 1, 0, 2, '', '', '', 'Avail', '', '_bx_msg_form_entry_input_text_err', 'XssHtml', '', 1, 0),
  105. ('bx_messages', 'bx_messages', 'recipients', '', '', 0, 'custom', '_bx_msg_form_entry_input_sys_recipients', '_bx_msg_form_entry_input_recipients', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_msg_form_entry_input_recipients_err', '', '', 1, 0),
  106. ('bx_messages', 'bx_messages', 'pictures', '', '', 0, 'files', '_bx_msg_form_entry_input_sys_pictures', '_bx_msg_form_entry_input_pictures', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
  107. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  108. ('bx_messages_entry_add', 'delete_confirm', 2147483647, 0, 0),
  109. ('bx_messages_entry_add', 'recipients', 2147483647, 1, 1),
  110. ('bx_messages_entry_add', 'text', 2147483647, 1, 2),
  111. ('bx_messages_entry_add', 'pictures', 2147483647, 1, 3),
  112. ('bx_messages_entry_add', 'do_submit', 2147483647, 1, 4),
  113. ('bx_messages_entry_view', 'delete_confirm', 2147483647, 0, 0),
  114. ('bx_messages_entry_view', 'do_submit', 2147483647, 0, 0),
  115. ('bx_messages_entry_view', 'recipients', 2147483647, 0, 0),
  116. ('bx_messages_entry_view', 'text', 2147483647, 0, 0),
  117. ('bx_messages_entry_view', 'pictures', 2147483647, 0, 0),
  118. ('bx_messages_entry_delete', 'delete_confirm', 2147483647, 1, 1),
  119. ('bx_messages_entry_delete', 'do_submit', 2147483647, 1, 2),
  120. ('bx_messages_entry_delete', 'pictures', 2147483647, 0, 0),
  121. ('bx_messages_entry_delete', 'recipients', 2147483647, 0, 0),
  122. ('bx_messages_entry_delete', 'text', 2147483647, 0, 0);
  123. -- STUDIO: page & widget
  124. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  125. (3, 'bx_messages', '_bx_msg', '_bx_msg', 'bx_messages@modules/boonex/messages/|std-pi.png');
  126. SET @iPageId = LAST_INSERT_ID();
  127. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  128. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  129. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  130. (@iPageId, 'bx_messages', '{url_studio}module.php?name=bx_messages', '', 'bx_messages@modules/boonex/messages/|std-wi.png', '_bx_msg', '', '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";}');
  131. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  132. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));