install.sql 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. SET @sName = 'bx_notifications';
  2. -- TABLES
  3. CREATE TABLE IF NOT EXISTS `bx_notifications_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. `date` int(11) NOT NULL default '0',
  12. `active` tinyint(4) NOT NULL default '1',
  13. PRIMARY KEY (`id`),
  14. KEY `owner_id` (`owner_id`)
  15. );
  16. CREATE TABLE IF NOT EXISTS `bx_notifications_events2users` (
  17. `user_id` int(11) NOT NULL DEFAULT '0',
  18. `event_id` int(11) NOT NULL DEFAULT '0',
  19. PRIMARY KEY (`user_id`)
  20. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  21. CREATE TABLE IF NOT EXISTS `bx_notifications_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. -- STUDIO PAGE & WIDGET
  31. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  32. (3, @sName, '_bx_ntfs', '_bx_ntfs', 'bx_notifications@modules/boonex/notifications/|std-pi.png');
  33. SET @iPageId = LAST_INSERT_ID();
  34. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  35. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  36. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  37. (@iPageId, @sName, '{url_studio}module.php?name=bx_notifications', '', 'bx_notifications@modules/boonex/notifications/|std-wi.png', '_bx_ntfs', '', '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";}');
  38. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  39. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));