install.sql 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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) NOT NULL,
  7. `action` varchar(255) NOT NULL,
  8. `object_id` text NOT NULL,
  9. `object_owner_id` int(11) unsigned NOT NULL default '0',
  10. `object_privacy_view` varchar(32) NOT NULL default '3',
  11. `subobject_id` int(11) NOT NULL default '0',
  12. `content` text NOT NULL,
  13. `allow_view_event_to` varchar(32) NOT NULL default '3',
  14. `date` int(11) NOT NULL default '0',
  15. `processed` tinyint(4) NOT NULL default '0',
  16. `active` tinyint(4) NOT NULL default '1',
  17. PRIMARY KEY (`id`),
  18. KEY `owner_id` (`owner_id`)
  19. );
  20. CREATE TABLE IF NOT EXISTS `bx_notifications_events2users` (
  21. `user_id` int(11) NOT NULL DEFAULT '0',
  22. `event_id` int(11) NOT NULL DEFAULT '0',
  23. PRIMARY KEY (`user_id`)
  24. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  25. CREATE TABLE IF NOT EXISTS `bx_notifications_handlers` (
  26. `id` int(11) NOT NULL auto_increment,
  27. `group` varchar(64) NOT NULL default '',
  28. `type` enum('insert','update','delete') NOT NULL DEFAULT 'insert',
  29. `alert_unit` varchar(64) NOT NULL default '',
  30. `alert_action` varchar(64) NOT NULL default '',
  31. `content` text NOT NULL,
  32. `privacy` varchar(64) NOT NULL default '',
  33. PRIMARY KEY (`id`),
  34. UNIQUE `handler` (`group`, `type`),
  35. UNIQUE `alert` (`alert_unit`, `alert_action`)
  36. );
  37. INSERT INTO `bx_notifications_handlers`(`group`, `type`, `alert_unit`, `alert_action`, `content`) VALUES
  38. ('profile', 'delete', 'profile', 'delete', ''),
  39. ('subscription', 'insert', 'sys_profiles_subscriptions', 'connection_added', 'a:3:{s:11:"module_name";s:6:"system";s:13:"module_method";s:22:"get_notifications_post";s:12:"module_class";s:23:"TemplServiceConnections";}'),
  40. ('subscription', 'delete', 'sys_profiles_subscriptions', 'connection_removed', '');
  41. -- STUDIO PAGE & WIDGET
  42. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  43. (3, @sName, '_bx_ntfs', '_bx_ntfs', 'bx_notifications@modules/boonex/notifications/|std-icon.svg');
  44. SET @iPageId = LAST_INSERT_ID();
  45. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  46. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  47. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  48. (@iPageId, @sName, '{url_studio}module.php?name=bx_notifications', '', 'bx_notifications@modules/boonex/notifications/|std-icon.svg', '_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";}');
  49. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  50. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));