install.sql 7.8 KB

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