install.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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_photos2events` (
  68. `id` int(11) NOT NULL AUTO_INCREMENT,
  69. `event_id` int(11) NOT NULL DEFAULT '0',
  70. `photo_id` int(11) NOT NULL DEFAULT '0',
  71. `title` varchar(255) collate utf8_unicode_ci NOT NULL,
  72. `text` text collate utf8_unicode_ci NOT NULL,
  73. PRIMARY KEY (`id`),
  74. UNIQUE KEY `photo` (`event_id`, `photo_id`)
  75. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  76. -- TABLES: COMMENTS
  77. CREATE TABLE IF NOT EXISTS `bx_timeline_comments` (
  78. `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
  79. `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
  80. `cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
  81. `cmt_object_id` int(11) NOT NULL DEFAULT '0',
  82. `cmt_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  83. `cmt_level` int(11) NOT NULL DEFAULT '0',
  84. `cmt_text` text NOT NULL,
  85. `cmt_rate` int(11) NOT NULL DEFAULT '0',
  86. `cmt_rate_count` int(11) NOT NULL DEFAULT '0',
  87. `cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
  88. `cmt_replies` int(11) NOT NULL DEFAULT '0',
  89. PRIMARY KEY (`cmt_id`),
  90. KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
  91. );
  92. CREATE TABLE IF NOT EXISTS `bx_timeline_comments_track` (
  93. `cmt_system_id` int(11) NOT NULL DEFAULT '0',
  94. `cmt_id` int(11) NOT NULL DEFAULT '0',
  95. `cmt_rate` tinyint(4) NOT NULL DEFAULT '0',
  96. `cmt_rate_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  97. `cmt_rate_author_nip` int(11) unsigned NOT NULL DEFAULT '0',
  98. `cmt_rate_ts` int(11) NOT NULL DEFAULT '0',
  99. PRIMARY KEY (`cmt_system_id`,`cmt_id`,`cmt_rate_author_nip`)
  100. );
  101. -- TABLES: VOTES
  102. CREATE TABLE IF NOT EXISTS `bx_timeline_votes` (
  103. `object_id` int(11) NOT NULL default '0',
  104. `count` int(11) NOT NULL default '0',
  105. `sum` int(11) NOT NULL default '0',
  106. UNIQUE KEY `object_id` (`object_id`)
  107. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  108. CREATE TABLE IF NOT EXISTS `bx_timeline_votes_track` (
  109. `object_id` int(11) NOT NULL default '0',
  110. `author_id` int(11) NOT NULL default '0',
  111. `author_nip` int(11) unsigned NOT NULL default '0',
  112. `value` tinyint(4) NOT NULL default '0',
  113. `date` int(11) NOT NULL default '0',
  114. KEY `vote` (`object_id`, `author_nip`)
  115. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  116. -- Forms -> Text
  117. 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
  118. ('mod_tml_text', @sName, '_bx_timeline_form_text', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
  119. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  120. ('mod_tml_text_add', @sName, 'mod_tml_text', '_bx_timeline_form_text_display_add', 0);
  121. 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
  122. ('mod_tml_text', @sName, 'type', 'text', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  123. ('mod_tml_text', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  124. ('mod_tml_text', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
  125. ('mod_tml_text', @sName, 'content', '', '', 0, 'textarea', '_bx_timeline_form_text_input_sys_content', '_bx_timeline_form_text_input_content', '', 0, 0, 0, '', '', '', 'Avail', '', '_bx_timeline_form_text_input_err_content', 'Xss', '', 0, 0),
  126. ('mod_tml_text', @sName, 'do_submit', '_bx_timeline_form_text_input_do_submit', '', 0, 'submit', '_bx_timeline_form_text_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
  127. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  128. ('mod_tml_text_add', 'type', 2147483647, 1, 1),
  129. ('mod_tml_text_add', 'action', 2147483647, 1, 2),
  130. ('mod_tml_text_add', 'owner_id', 2147483647, 1, 3),
  131. ('mod_tml_text_add', 'content', 2147483647, 1, 4),
  132. ('mod_tml_text_add', 'do_submit', 2147483647, 1, 5);
  133. -- Forms -> Link
  134. 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
  135. ('mod_tml_link', @sName, '_bx_timeline_form_link', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
  136. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  137. ('mod_tml_link_add', @sName, 'mod_tml_link', '_bx_timeline_form_link_display_add', 0);
  138. 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
  139. ('mod_tml_link', @sName, 'type', 'link', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  140. ('mod_tml_link', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  141. ('mod_tml_link', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
  142. ('mod_tml_link', @sName, 'content', '', '', 0, 'text', '_bx_timeline_form_link_input_sys_content', '_bx_timeline_form_link_input_content', '', 0, 0, 0, '', '', '', 'Avail', '', '_bx_timeline_form_link_input_err_content', 'Xss', '', 0, 0),
  143. ('mod_tml_link', @sName, 'do_submit', '_bx_timeline_form_link_input_do_submit', '', 0, 'submit', '_bx_timeline_form_link_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
  144. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  145. ('mod_tml_link_add', 'type', 2147483647, 1, 1),
  146. ('mod_tml_link_add', 'action', 2147483647, 1, 2),
  147. ('mod_tml_link_add', 'owner_id', 2147483647, 1, 3),
  148. ('mod_tml_link_add', 'content', 2147483647, 1, 4),
  149. ('mod_tml_link_add', 'do_submit', 2147483647, 1, 5);
  150. -- Forms -> Photo
  151. 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
  152. ('mod_tml_photo', @sName, '_bx_timeline_form_photo', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
  153. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  154. ('mod_tml_photo_add', @sName, 'mod_tml_photo', '_bx_timeline_form_photo_display_add', 0);
  155. 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
  156. ('mod_tml_photo', @sName, 'type', 'photo', '', 0, 'hidden', '_bx_timeline_form_photo_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  157. ('mod_tml_photo', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_photo_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  158. ('mod_tml_photo', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_photo_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
  159. ('mod_tml_photo', @sName, 'content', '', '', 0, 'files', '_bx_timeline_form_photo_input_sys_content', '_bx_timeline_form_photo_input_content', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  160. ('mod_tml_photo', @sName, 'do_submit', '_bx_timeline_form_photo_input_do_submit', '', 0, 'submit', '_bx_timeline_form_photo_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
  161. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  162. ('mod_tml_photo_add', 'type', 2147483647, 1, 1),
  163. ('mod_tml_photo_add', 'action', 2147483647, 1, 2),
  164. ('mod_tml_photo_add', 'owner_id', 2147483647, 1, 3),
  165. ('mod_tml_photo_add', 'content', 2147483647, 1, 4),
  166. ('mod_tml_photo_add', 'do_submit', 2147483647, 1, 5);
  167. -- STUDIO PAGE & WIDGET
  168. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  169. (3, 'bx_timeline', '_bx_timeline', '_bx_timeline', 'bx_timeline@modules/boonex/timeline/|std-pi.png');
  170. SET @iPageId = LAST_INSERT_ID();
  171. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  172. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  173. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  174. (@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";}');
  175. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  176. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));