1
0

install.sql 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. -- TABLE: entries
  2. CREATE TABLE IF NOT EXISTS `bx_convos_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_convos_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_convos_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_convos_folders` (`id`, `author`, `name`) VALUES
  33. (1, 0, '_bx_cnv_folder_inbox'),
  34. (2, 0, '_bx_cnv_folder_drafts'),
  35. (3, 0, '_bx_cnv_folder_spam'),
  36. (4, 0, '_bx_cnv_folder_trash');
  37. -- TABLE: storages & transcoders
  38. CREATE TABLE IF NOT EXISTS `bx_convos_files` (
  39. `id` int(11) NOT NULL AUTO_INCREMENT,
  40. `profile_id` int(10) unsigned NOT NULL,
  41. `remote_id` varchar(255) NOT NULL,
  42. `path` varchar(255) NOT NULL,
  43. `file_name` varchar(255) NOT NULL,
  44. `mime_type` varchar(128) NOT NULL,
  45. `ext` varchar(32) NOT NULL,
  46. `size` int(11) NOT NULL,
  47. `added` int(11) NOT NULL,
  48. `modified` int(11) NOT NULL,
  49. `private` int(11) NOT NULL,
  50. PRIMARY KEY (`id`),
  51. UNIQUE KEY `remote_id` (`remote_id`)
  52. );
  53. CREATE TABLE IF NOT EXISTS `bx_convos_photos_resized` (
  54. `id` int(11) NOT NULL AUTO_INCREMENT,
  55. `profile_id` int(10) unsigned NOT NULL,
  56. `remote_id` varchar(255) NOT NULL,
  57. `path` varchar(255) NOT NULL,
  58. `file_name` varchar(255) NOT NULL,
  59. `mime_type` varchar(128) NOT NULL,
  60. `ext` varchar(32) NOT NULL,
  61. `size` int(11) NOT NULL,
  62. `added` int(11) NOT NULL,
  63. `modified` int(11) NOT NULL,
  64. `private` int(11) NOT NULL,
  65. PRIMARY KEY (`id`),
  66. UNIQUE KEY `remote_id` (`remote_id`)
  67. );
  68. -- TABLE: comments
  69. CREATE TABLE IF NOT EXISTS `bx_convos_cmts` (
  70. `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
  71. `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
  72. `cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
  73. `cmt_object_id` int(11) NOT NULL DEFAULT '0',
  74. `cmt_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  75. `cmt_level` int(11) NOT NULL DEFAULT '0',
  76. `cmt_text` text NOT NULL,
  77. `cmt_mood` tinyint(4) NOT NULL DEFAULT '0',
  78. `cmt_rate` int(11) NOT NULL DEFAULT '0',
  79. `cmt_rate_count` int(11) NOT NULL DEFAULT '0',
  80. `cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
  81. `cmt_replies` int(11) NOT NULL DEFAULT '0',
  82. PRIMARY KEY (`cmt_id`),
  83. KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
  84. );
  85. -- TABLE: views
  86. CREATE TABLE `bx_convos_views_track` (
  87. `object_id` int(11) NOT NULL default '0',
  88. `viewer_id` int(11) NOT NULL default '0',
  89. `viewer_nip` int(11) unsigned NOT NULL default '0',
  90. `date` int(11) NOT NULL default '0',
  91. KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
  92. );
  93. -- FORMS
  94. 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
  95. ('bx_convos', 'bx_convos', '_bx_cnv_form_entry', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_convos_conversations', 'id', '', '', 'do_submit', '', 0, 1, 'BxCnvFormEntry', 'modules/boonex/convos/classes/BxCnvFormEntry.php');
  96. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  97. ('bx_convos', 'bx_convos_entry_add', 'bx_convos', 0, '_bx_cnv_form_entry_display_add'),
  98. ('bx_convos', 'bx_convos_entry_delete', 'bx_convos', 0, '_bx_cnv_form_entry_display_delete'),
  99. ('bx_convos', 'bx_convos_entry_view', 'bx_convos', 1, '_bx_cnv_form_entry_display_view');
  100. 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
  101. ('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),
  102. ('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),
  103. ('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),
  104. ('bx_convos', 'bx_convos', 'recipients', '', '', 0, 'custom', '_bx_cnv_form_entry_input_sys_recipients', '_bx_cnv_form_entry_input_recipients', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_cnv_form_entry_input_recipients_err', '', '', 1, 0),
  105. ('bx_convos', 'bx_convos', 'attachments', '', '', 0, 'files', '_bx_cnv_form_entry_input_sys_attachments', '_bx_cnv_form_entry_input_attachments', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
  106. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  107. ('bx_convos_entry_add', 'delete_confirm', 2147483647, 0, 0),
  108. ('bx_convos_entry_add', 'recipients', 2147483647, 1, 1),
  109. ('bx_convos_entry_add', 'text', 2147483647, 1, 2),
  110. ('bx_convos_entry_add', 'attachments', 2147483647, 1, 3),
  111. ('bx_convos_entry_add', 'do_submit', 2147483647, 1, 4),
  112. ('bx_convos_entry_view', 'delete_confirm', 2147483647, 0, 0),
  113. ('bx_convos_entry_view', 'do_submit', 2147483647, 0, 0),
  114. ('bx_convos_entry_view', 'recipients', 2147483647, 0, 0),
  115. ('bx_convos_entry_view', 'text', 2147483647, 0, 0),
  116. ('bx_convos_entry_view', 'attachments', 2147483647, 0, 0),
  117. ('bx_convos_entry_delete', 'delete_confirm', 2147483647, 1, 1),
  118. ('bx_convos_entry_delete', 'do_submit', 2147483647, 1, 2),
  119. ('bx_convos_entry_delete', 'attachments', 2147483647, 0, 0),
  120. ('bx_convos_entry_delete', 'recipients', 2147483647, 0, 0),
  121. ('bx_convos_entry_delete', 'text', 2147483647, 0, 0);
  122. -- STUDIO: page & widget
  123. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  124. (3, 'bx_convos', '_bx_cnv', '_bx_cnv', 'bx_convos@modules/boonex/convos/|std-pi.png');
  125. SET @iPageId = LAST_INSERT_ID();
  126. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  127. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  128. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  129. (@iPageId, 'bx_convos', '{url_studio}module.php?name=bx_convos', '', 'bx_convos@modules/boonex/convos/|std-wi.png', '_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";}');
  130. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  131. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));