install.sql 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. `last_reply_comment_id` int(11) NOT NULL,
  13. PRIMARY KEY (`id`),
  14. KEY `last_reply_timestamp` (`last_reply_timestamp`)
  15. );
  16. CREATE TABLE IF NOT EXISTS `bx_convos_conv2folder` (
  17. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  18. `conv_id` int(10) unsigned NOT NULL,
  19. `folder_id` int(10) unsigned NOT NULL,
  20. `collaborator` int(10) unsigned NOT NULL,
  21. `read_comments` int(11) NOT NULL default '-1',
  22. PRIMARY KEY (`id`),
  23. UNIQUE KEY `collaborator_folder_conv` (`collaborator`,`folder_id`, `conv_id`),
  24. KEY `conv_id` (`conv_id`)
  25. );
  26. CREATE TABLE IF NOT EXISTS `bx_convos_folders` (
  27. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  28. `author` int(10) unsigned NOT NULL,
  29. `name` varchar(255) NOT NULL DEFAULT '',
  30. PRIMARY KEY (`id`),
  31. KEY `author` (`author`)
  32. );
  33. INSERT INTO `bx_convos_folders` (`id`, `author`, `name`) VALUES
  34. (1, 0, '_bx_cnv_folder_inbox'),
  35. (2, 0, '_bx_cnv_folder_drafts'),
  36. (3, 0, '_bx_cnv_folder_spam'),
  37. (4, 0, '_bx_cnv_folder_trash');
  38. -- TABLE: storages & transcoders
  39. CREATE TABLE IF NOT EXISTS `bx_convos_files` (
  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_convos_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_convos_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_convos_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. -- STORAGES & TRANSCODERS
  95. 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
  96. ('bx_convos_files', 'Local', '', 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),
  97. ('bx_convos_photos_resized', 'Local', '', 360, 2592000, 3, 'bx_convos_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
  98. INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
  99. ('bx_convos_preview', 'bx_convos_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_convos_files";}', 'no', '1', '2592000', '0');
  100. INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
  101. ('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');
  102. -- FORMS
  103. 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
  104. ('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');
  105. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  106. ('bx_convos', 'bx_convos_entry_add', 'bx_convos', 0, '_bx_cnv_form_entry_display_add'),
  107. ('bx_convos', 'bx_convos_entry_delete', 'bx_convos', 0, '_bx_cnv_form_entry_display_delete'),
  108. ('bx_convos', 'bx_convos_entry_view', 'bx_convos', 1, '_bx_cnv_form_entry_display_view');
  109. 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
  110. ('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),
  111. ('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),
  112. ('bx_convos', 'bx_convos', 'submit_text', '', '', 0, 'custom', '_bx_cnv_form_entry_input_sys_submit_text', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  113. ('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),
  114. ('bx_convos', 'bx_convos', 'draft_id', '0', '', 0, 'hidden', '_bx_cnv_form_entry_input_sys_draft_id', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  115. ('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),
  116. ('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),
  117. ('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);
  118. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  119. ('bx_convos_entry_add', 'delete_confirm', 2147483647, 0, 0),
  120. ('bx_convos_entry_add', 'recipients', 2147483647, 1, 1),
  121. ('bx_convos_entry_add', 'text', 2147483647, 1, 2),
  122. ('bx_convos_entry_add', 'attachments', 2147483647, 1, 3),
  123. ('bx_convos_entry_add', 'submit_block', 2147483647, 1, 4),
  124. ('bx_convos_entry_add', 'do_submit', 2147483647, 1, 5),
  125. ('bx_convos_entry_add', 'submit_text', 2147483647, 1, 6),
  126. ('bx_convos_entry_add', 'draft_id', 2147483647, 1, 7),
  127. ('bx_convos_entry_view', 'delete_confirm', 2147483647, 0, 0),
  128. ('bx_convos_entry_view', 'do_submit', 2147483647, 0, 0),
  129. ('bx_convos_entry_view', 'recipients', 2147483647, 0, 0),
  130. ('bx_convos_entry_view', 'text', 2147483647, 0, 0),
  131. ('bx_convos_entry_view', 'attachments', 2147483647, 0, 0),
  132. ('bx_convos_entry_delete', 'delete_confirm', 2147483647, 1, 1),
  133. ('bx_convos_entry_delete', 'do_submit', 2147483647, 1, 2),
  134. ('bx_convos_entry_delete', 'attachments', 2147483647, 0, 0),
  135. ('bx_convos_entry_delete', 'recipients', 2147483647, 0, 0),
  136. ('bx_convos_entry_delete', 'text', 2147483647, 0, 0);
  137. -- STUDIO: page & widget
  138. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  139. (3, 'bx_convos', '_bx_cnv', '_bx_cnv', 'bx_convos@modules/boonex/convos/|std-pi.png');
  140. SET @iPageId = LAST_INSERT_ID();
  141. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  142. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  143. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  144. (@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";}');
  145. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  146. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));