install.sql 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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(10) 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. `comments` int(10) unsigned NOT NULL default '0',
  14. `date` int(11) NOT NULL default '0',
  15. PRIMARY KEY (`id`),
  16. KEY `owner_id` (`owner_id`)
  17. );
  18. CREATE TABLE IF NOT EXISTS `bx_timeline_handlers` (
  19. `id` int(11) NOT NULL auto_increment,
  20. `type` enum('insert','update','delete') NOT NULL DEFAULT 'insert',
  21. `alert_unit` varchar(64) NOT NULL default '',
  22. `alert_action` varchar(64) NOT NULL default '',
  23. `content` text collate utf8_unicode_ci NOT NULL,
  24. PRIMARY KEY (`id`),
  25. UNIQUE `handler` (`alert_unit`, `alert_action`)
  26. );
  27. INSERT INTO `bx_timeline_handlers`(`type`, `alert_unit`, `alert_action`, `content`) VALUES
  28. ('insert', 'timeline_common_text', '', ''),
  29. ('insert', 'timeline_common_link', '', ''),
  30. ('insert', 'timeline_common_photos', '', ''),
  31. ('insert', 'timeline_common_sounds', '', ''),
  32. ('insert', 'timeline_common_videos', '', '');
  33. -- TABLE: COMMENTS
  34. CREATE TABLE IF NOT EXISTS `bx_timeline_comments` (
  35. `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
  36. `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
  37. `cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
  38. `cmt_object_id` int(11) NOT NULL DEFAULT '0',
  39. `cmt_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  40. `cmt_level` int(11) NOT NULL DEFAULT '0',
  41. `cmt_text` text NOT NULL,
  42. `cmt_rate` int(11) NOT NULL DEFAULT '0',
  43. `cmt_rate_count` int(11) NOT NULL DEFAULT '0',
  44. `cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
  45. `cmt_replies` int(11) NOT NULL DEFAULT '0',
  46. PRIMARY KEY (`cmt_id`),
  47. KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
  48. );
  49. CREATE TABLE IF NOT EXISTS `bx_timeline_comments_track` (
  50. `cmt_system_id` int(11) NOT NULL DEFAULT '0',
  51. `cmt_id` int(11) NOT NULL DEFAULT '0',
  52. `cmt_rate` tinyint(4) NOT NULL DEFAULT '0',
  53. `cmt_rate_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  54. `cmt_rate_author_nip` int(11) unsigned NOT NULL DEFAULT '0',
  55. `cmt_rate_ts` int(11) NOT NULL DEFAULT '0',
  56. PRIMARY KEY (`cmt_system_id`,`cmt_id`,`cmt_rate_author_nip`)
  57. );
  58. -- Forms -> Text
  59. 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
  60. ('mod_tml_text', @sName, '_bx_timeline_form_text', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
  61. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  62. ('mod_tml_text_add', @sName, 'mod_tml_text', '_bx_timeline_form_text_display_add', 0);
  63. 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
  64. ('mod_tml_text', @sName, 'type', 'text', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  65. ('mod_tml_text', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  66. ('mod_tml_text', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_text_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
  67. ('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),
  68. ('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);
  69. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  70. ('mod_tml_text_add', 'type', 2147483647, 1, 1),
  71. ('mod_tml_text_add', 'action', 2147483647, 1, 2),
  72. ('mod_tml_text_add', 'owner_id', 2147483647, 1, 3),
  73. ('mod_tml_text_add', 'content', 2147483647, 1, 4),
  74. ('mod_tml_text_add', 'do_submit', 2147483647, 1, 5);
  75. -- Forms -> Link
  76. 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
  77. ('mod_tml_link', @sName, '_bx_timeline_form_link', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
  78. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  79. ('mod_tml_link_add', @sName, 'mod_tml_link', '_bx_timeline_form_link_display_add', 0);
  80. 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
  81. ('mod_tml_link', @sName, 'type', 'link', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_type', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  82. ('mod_tml_link', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  83. ('mod_tml_link', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_link_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
  84. ('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),
  85. ('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);
  86. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  87. ('mod_tml_link_add', 'type', 2147483647, 1, 1),
  88. ('mod_tml_link_add', 'action', 2147483647, 1, 2),
  89. ('mod_tml_link_add', 'owner_id', 2147483647, 1, 3),
  90. ('mod_tml_link_add', 'content', 2147483647, 1, 4),
  91. ('mod_tml_link_add', 'do_submit', 2147483647, 1, 5);
  92. -- STUDIO PAGE & WIDGET
  93. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  94. (3, 'bx_timeline', '_bx_timeline', '_bx_timeline', 'bx_timeline@modules/boonex/timeline/|std-pi.png');
  95. SET @iPageId = LAST_INSERT_ID();
  96. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  97. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  98. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  99. (@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";}');
  100. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  101. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));