install.sql 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_owner_id` int(11) unsigned NOT NULL default '0',
  10. `object_privacy_view` int(11) NOT NULL default '3',
  11. `subobject_id` int(11) NOT NULL default '0',
  12. `content` text collate utf8_unicode_ci NOT NULL,
  13. `date` int(11) NOT NULL default '0',
  14. `processed` tinyint(4) NOT NULL default '0',
  15. `active` tinyint(4) NOT NULL default '1',
  16. PRIMARY KEY (`id`),
  17. KEY `owner_id` (`owner_id`)
  18. );
  19. CREATE TABLE IF NOT EXISTS `bx_notifications_events2users` (
  20. `user_id` int(11) NOT NULL DEFAULT '0',
  21. `event_id` int(11) NOT NULL DEFAULT '0',
  22. PRIMARY KEY (`user_id`)
  23. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  24. CREATE TABLE IF NOT EXISTS `bx_notifications_handlers` (
  25. `id` int(11) NOT NULL auto_increment,
  26. `group` varchar(64) NOT NULL default '',
  27. `type` enum('insert','update','delete') NOT NULL DEFAULT 'insert',
  28. `alert_unit` varchar(64) NOT NULL default '',
  29. `alert_action` varchar(64) NOT NULL default '',
  30. `content` text collate utf8_unicode_ci NOT NULL,
  31. PRIMARY KEY (`id`),
  32. UNIQUE `handler` (`group`, `type`),
  33. UNIQUE `alert` (`alert_unit`, `alert_action`)
  34. );
  35. INSERT INTO `bx_notifications_handlers`(`group`, `type`, `alert_unit`, `alert_action`, `content`) VALUES
  36. ('profile', 'delete', 'profile', 'delete', '');
  37. -- STUDIO PAGE & WIDGET
  38. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  39. (3, @sName, '_bx_ntfs', '_bx_ntfs', 'bx_notifications@modules/boonex/notifications/|std-pi.png');
  40. SET @iPageId = LAST_INSERT_ID();
  41. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  42. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  43. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  44. (@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";}');
  45. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  46. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));