install.sql 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. SET @sName = 'bx_timeline';
  2. -- TABLES
  3. CREATE TABLE IF NOT EXISTS `bx_timeline_events` (
  4. `id` int(11) NOT NULL auto_increment,
  5. `owner_id` int(11) unsigned NOT NULL default '0',
  6. `type` varchar(255) collate utf8_unicode_ci NOT NULL,
  7. `action` varchar(255) collate utf8_unicode_ci NOT NULL,
  8. `object_id` text collate utf8_unicode_ci NOT NULL,
  9. `object_privacy_view` int(11) NOT NULL default '3',
  10. `content` text collate utf8_unicode_ci NOT NULL,
  11. `title` varchar(255) collate utf8_unicode_ci NOT NULL,
  12. `description` text collate utf8_unicode_ci NOT NULL,
  13. `rate` float NOT NULL default '0',
  14. `votes` int(11) unsigned NOT NULL default '0',
  15. `comments` int(11) unsigned NOT NULL default '0',
  16. `shares` int(11) unsigned NOT NULL default '0',
  17. `date` int(11) NOT NULL default '0',
  18. PRIMARY KEY (`id`),
  19. KEY `owner_id` (`owner_id`)
  20. );
  21. CREATE TABLE IF NOT EXISTS `bx_timeline_handlers` (
  22. `id` int(11) NOT NULL auto_increment,
  23. `type` enum('insert','update','delete') NOT NULL DEFAULT 'insert',
  24. `alert_unit` varchar(64) NOT NULL default '',
  25. `alert_action` varchar(64) NOT NULL default '',
  26. `content` text collate utf8_unicode_ci NOT NULL,
  27. PRIMARY KEY (`id`),
  28. UNIQUE `handler` (`alert_unit`, `alert_action`)
  29. );
  30. INSERT INTO `bx_timeline_handlers`(`type`, `alert_unit`, `alert_action`, `content`) VALUES
  31. ('insert', 'timeline_common_text', '', ''),
  32. ('insert', 'timeline_common_link', '', ''),
  33. ('insert', 'timeline_common_photos', '', ''),
  34. ('insert', 'timeline_common_sounds', '', ''),
  35. ('insert', 'timeline_common_videos', '', '');
  36. -- TABLES: UPLOADERS
  37. CREATE TABLE IF NOT EXISTS `bx_timeline_photos` (
  38. `id` int(11) NOT NULL AUTO_INCREMENT,
  39. `profile_id` int(10) unsigned NOT NULL,
  40. `remote_id` varchar(255) NOT NULL,
  41. `path` varchar(255) NOT NULL,
  42. `file_name` varchar(255) NOT NULL,
  43. `mime_type` varchar(128) NOT NULL,
  44. `ext` varchar(32) NOT NULL,
  45. `size` int(11) NOT NULL,
  46. `added` int(11) NOT NULL,
  47. `modified` int(11) NOT NULL,
  48. `private` int(11) NOT NULL,
  49. PRIMARY KEY (`id`),
  50. UNIQUE KEY `remote_id` (`remote_id`)
  51. );
  52. CREATE TABLE IF NOT EXISTS `bx_timeline_photos_preview` (
  53. `id` int(11) NOT NULL AUTO_INCREMENT,
  54. `profile_id` int(10) unsigned NOT NULL,
  55. `remote_id` varchar(255) NOT NULL,
  56. `path` varchar(255) NOT NULL,
  57. `file_name` varchar(255) NOT NULL,
  58. `mime_type` varchar(128) NOT NULL,
  59. `ext` varchar(32) NOT NULL,
  60. `size` int(11) NOT NULL,
  61. `added` int(11) NOT NULL,
  62. `modified` int(11) NOT NULL,
  63. `private` int(11) NOT NULL,
  64. PRIMARY KEY (`id`),
  65. UNIQUE KEY `remote_id` (`remote_id`)
  66. );
  67. CREATE TABLE IF NOT EXISTS `bx_timeline_photos_view` (
  68. `id` int(11) NOT NULL AUTO_INCREMENT,
  69. `profile_id` int(10) unsigned NOT NULL,
  70. `remote_id` varchar(255) NOT NULL,
  71. `path` varchar(255) NOT NULL,
  72. `file_name` varchar(255) NOT NULL,
  73. `mime_type` varchar(128) NOT NULL,
  74. `ext` varchar(32) NOT NULL,
  75. `size` int(11) NOT NULL,
  76. `added` int(11) NOT NULL,
  77. `modified` int(11) NOT NULL,
  78. `private` int(11) NOT NULL,
  79. PRIMARY KEY (`id`),
  80. UNIQUE KEY `remote_id` (`remote_id`)
  81. );
  82. CREATE TABLE IF NOT EXISTS `bx_timeline_photos2events` (
  83. `id` int(11) NOT NULL AUTO_INCREMENT,
  84. `event_id` int(11) NOT NULL DEFAULT '0',
  85. `photo_id` int(11) NOT NULL DEFAULT '0',
  86. `title` varchar(255) collate utf8_unicode_ci NOT NULL,
  87. `text` text collate utf8_unicode_ci NOT NULL,
  88. PRIMARY KEY (`id`),
  89. UNIQUE KEY `photo` (`event_id`, `photo_id`)
  90. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  91. -- TABLES: SHARES
  92. CREATE TABLE IF NOT EXISTS `bx_timeline_shares_track` (
  93. `event_id` int(11) NOT NULL default '0',
  94. `author_id` int(11) NOT NULL default '0',
  95. `author_nip` int(11) unsigned NOT NULL default '0',
  96. `shared_id` int(11) NOT NULL default '0',
  97. `date` int(11) NOT NULL default '0',
  98. UNIQUE KEY `event_id` (`event_id`),
  99. KEY `share` (`shared_id`, `author_nip`)
  100. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  101. -- TABLES: COMMENTS
  102. CREATE TABLE IF NOT EXISTS `bx_timeline_comments` (
  103. `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
  104. `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
  105. `cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
  106. `cmt_object_id` int(11) NOT NULL DEFAULT '0',
  107. `cmt_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  108. `cmt_level` int(11) NOT NULL DEFAULT '0',
  109. `cmt_text` text NOT NULL,
  110. `cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
  111. `cmt_replies` int(11) NOT NULL DEFAULT '0',
  112. PRIMARY KEY (`cmt_id`),
  113. KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
  114. );
  115. -- TABLES: VOTES
  116. CREATE TABLE IF NOT EXISTS `bx_timeline_votes` (
  117. `object_id` int(11) NOT NULL default '0',
  118. `count` int(11) NOT NULL default '0',
  119. `sum` int(11) NOT NULL default '0',
  120. UNIQUE KEY `object_id` (`object_id`)
  121. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  122. CREATE TABLE IF NOT EXISTS `bx_timeline_votes_track` (
  123. `object_id` int(11) NOT NULL default '0',
  124. `author_id` int(11) NOT NULL default '0',
  125. `author_nip` int(11) unsigned NOT NULL default '0',
  126. `value` tinyint(4) NOT NULL default '0',
  127. `date` int(11) NOT NULL default '0',
  128. KEY `vote` (`object_id`, `author_nip`)
  129. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  130. -- Forms -> Post
  131. INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  132. ('mod_tml_post', @sName, '_bx_timeline_form_post', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
  133. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  134. ('mod_tml_post_add', @sName, 'mod_tml_post', '_bx_timeline_form_post_display_add', 0);
  135. 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
  136. ('mod_tml_post', @sName, 'type', 'post', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  137. ('mod_tml_post', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  138. ('mod_tml_post', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
  139. ('mod_tml_post', @sName, 'text', '', '', 0, 'textarea', '_bx_timeline_form_post_input_sys_text', '_bx_timeline_form_post_input_text', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  140. ('mod_tml_post', @sName, 'link', '', '', 0, 'text', '_bx_timeline_form_post_input_sys_link', '_bx_timeline_form_post_input_link', '', 0, 0, 0, '', 'a:1:{s:5:"style";s:12:"display:none";}', '', '', '', '', 'Xss', '', 0, 0),
  141. ('mod_tml_post', @sName, 'photo', '', '', 0, 'files', '_bx_timeline_form_post_input_sys_photo', '_bx_timeline_form_post_input_photo', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  142. ('mod_tml_post', @sName, 'do_submit', '_bx_timeline_form_post_input_do_submit', '', 0, 'submit', '_bx_timeline_form_post_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
  143. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  144. ('mod_tml_post_add', 'type', 2147483647, 1, 1),
  145. ('mod_tml_post_add', 'action', 2147483647, 1, 2),
  146. ('mod_tml_post_add', 'owner_id', 2147483647, 1, 3),
  147. ('mod_tml_post_add', 'text', 2147483647, 1, 4),
  148. ('mod_tml_post_add', 'link', 2147483647, 1, 5),
  149. ('mod_tml_post_add', 'photo', 2147483647, 1, 6),
  150. ('mod_tml_post_add', 'do_submit', 2147483647, 1, 7);
  151. -- STUDIO PAGE & WIDGET
  152. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  153. (3, 'bx_timeline', '_bx_timeline', '_bx_timeline', 'bx_timeline@modules/boonex/timeline/|std-pi.png');
  154. SET @iPageId = LAST_INSERT_ID();
  155. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  156. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  157. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  158. (@iPageId, 'bx_timeline', '{url_studio}module.php?name=bx_timeline', '', 'bx_timeline@modules/boonex/timeline/|std-wi.png', '_bx_timeline', '', '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";}');
  159. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  160. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));