install.sql 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. SET @sName = 'bx_reputation';
  2. -- TABLE: handlers
  3. CREATE TABLE IF NOT EXISTS `bx_reputation_handlers` (
  4. `id` int(11) NOT NULL auto_increment,
  5. `group` varchar(64) NOT NULL default '',
  6. `type` enum('insert','update','delete') NOT NULL DEFAULT 'insert',
  7. `alert_unit` varchar(64) NOT NULL default '',
  8. `alert_action` varchar(64) NOT NULL default '',
  9. `points_active` int(11) NOT NULL default '0',
  10. `points_passive` int(11) NOT NULL default '0',
  11. `active` tinyint(4) NOT NULL default '1',
  12. PRIMARY KEY (`id`),
  13. UNIQUE `alert` (`alert_unit`, `alert_action`)
  14. );
  15. -- TABLES: events
  16. CREATE TABLE IF NOT EXISTS `bx_reputation_events` (
  17. `id` int(11) NOT NULL auto_increment,
  18. `owner_id` int(11) NOT NULL default '0',
  19. `type` varchar(64) NOT NULL default '',
  20. `action` varchar(64) NOT NULL default '',
  21. `object_id` int(11) NOT NULL default '0',
  22. `object_owner_id` int(11) NOT NULL default '0',
  23. `points` int(11) NOT NULL DEFAULT '0',
  24. `date` int(11) NOT NULL default '0',
  25. PRIMARY KEY (`id`),
  26. KEY `owner_id` (`owner_id`),
  27. KEY `object_id` (`object_id`)
  28. );
  29. -- TABLE: levels
  30. CREATE TABLE IF NOT EXISTS `bx_reputation_levels` (
  31. `id` int(11) NOT NULL auto_increment,
  32. `name` varchar(32) NOT NULL default '',
  33. `title` varchar(64) NOT NULL default '',
  34. `icon` text NOT NULL,
  35. `points_in` int(11) NOT NULL DEFAULT '0',
  36. `points_out` int(11) NOT NULL DEFAULT '0',
  37. `date` int(11) NOT NULL default '0',
  38. `active` tinyint(4) NOT NULL DEFAULT '1',
  39. `order` int(11) NOT NULL DEFAULT '0',
  40. PRIMARY KEY (`id`),
  41. UNIQUE KEY `name` (`name`)
  42. );
  43. -- TABLE: profiles
  44. CREATE TABLE IF NOT EXISTS `bx_reputation_profiles` (
  45. `id` int(11) NOT NULL DEFAULT '0',
  46. `points` int(11) NOT NULL DEFAULT '0',
  47. PRIMARY KEY (`id`)
  48. );
  49. -- TABLE: profiles' levels
  50. CREATE TABLE IF NOT EXISTS `bx_reputation_profiles_levels` (
  51. `id` int(11) NOT NULL auto_increment,
  52. `profile_id` int(11) NOT NULL DEFAULT '0',
  53. `level_id` int(11) NOT NULL DEFAULT '0',
  54. `date` int(11) NOT NULL default '0',
  55. PRIMARY KEY (`id`)
  56. );
  57. -- FORMS: handler
  58. 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
  59. ('bx_reputation_handler', @sName, '_bx_reputation_form_handler', '', '', 'do_submit', 'bx_reputation_handlers', 'id', '', '', '', 0, 1, '', '');
  60. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  61. ('bx_reputation_handler_edit', @sName, 'bx_reputation_handler', '_bx_reputation_form_handler_display_edit', 0);
  62. 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
  63. ('bx_reputation_handler', @sName, 'points_active', '', '', 0, 'text', '_bx_reputation_form_handler_input_sys_points_active', '_bx_reputation_form_handler_input_points_active', '_bx_reputation_form_handler_input_points_active_info', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  64. ('bx_reputation_handler', @sName, 'points_passive', '', '', 0, 'text', '_bx_reputation_form_handler_input_sys_points_passive', '_bx_reputation_form_handler_input_points_passive', '_bx_reputation_form_handler_input_points_passive_info', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  65. ('bx_reputation_handler', @sName, 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '_bx_reputation_form_handler_input_sys_controls', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  66. ('bx_reputation_handler', @sName, 'do_submit', '_bx_reputation_form_handler_input_do_submit', '', 0, 'submit', '_bx_reputation_form_handler_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  67. ('bx_reputation_handler', @sName, 'do_cancel', '_bx_reputation_form_handler_input_do_cancel', '', 0, 'button', '_bx_reputation_form_handler_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 1, 0);
  68. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  69. ('bx_reputation_handler_edit', 'points_active', 2147483647, 1, 1),
  70. ('bx_reputation_handler_edit', 'points_passive', 2147483647, 1, 2),
  71. ('bx_reputation_handler_edit', 'controls', 2147483647, 1, 3),
  72. ('bx_reputation_handler_edit', 'do_submit', 2147483647, 1, 4),
  73. ('bx_reputation_handler_edit', 'do_cancel', 2147483647, 1, 5);
  74. -- FORMS: level
  75. 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
  76. ('bx_reputation_level', @sName, '_bx_reputation_form_level', '', '', 'do_submit', 'bx_reputation_levels', 'id', '', '', '', 0, 1, 'BxReputationFormLevel', 'modules/boonex/reputation/classes/BxReputationFormLevel.php');
  77. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  78. ('bx_reputation_level_add', @sName, 'bx_reputation_level', '_bx_reputation_form_level_display_add', 0),
  79. ('bx_reputation_level_edit', @sName, 'bx_reputation_level', '_bx_reputation_form_level_display_edit', 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. ('bx_reputation_level', @sName, 'name', '', '', 0, 'text', '_bx_reputation_form_level_input_sys_name', '_bx_reputation_form_level_input_name', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_reputation_form_input_err', 'Xss', '', 1, 0),
  82. ('bx_reputation_level', @sName, 'title', '', '', 0, 'text_translatable', '_bx_reputation_form_level_input_sys_title', '_bx_reputation_form_level_input_title', '', 1, 0, 0, '', '', '', 'AvailTranslatable', 'a:1:{i:0;s:5:"title";}', '_bx_reputation_form_input_err', 'Xss', '', 1, 0),
  83. ('bx_reputation_level', @sName, 'icon', '', '', 0, 'textarea', '_bx_reputation_form_level_input_sys_icon', '_bx_reputation_form_level_input_icon', '_bx_reputation_form_level_input_icon_info', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
  84. ('bx_reputation_level', @sName, 'points_in', '', '', 0, 'text', '_bx_reputation_form_level_input_sys_points_in', '_bx_reputation_form_level_input_points_in', '_bx_reputation_form_level_input_points_in_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_reputation_form_input_err', 'Int', '', 1, 0),
  85. ('bx_reputation_level', @sName, 'points_out', '', '', 0, 'text', '_bx_reputation_form_level_input_sys_points_out', '_bx_reputation_form_level_input_points_out', '_bx_reputation_form_level_input_points_out_info', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  86. ('bx_reputation_level', @sName, 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '_bx_reputation_form_level_input_sys_controls', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  87. ('bx_reputation_level', @sName, 'do_submit', '_bx_reputation_form_level_input_do_submit', '', 0, 'submit', '_bx_reputation_form_level_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  88. ('bx_reputation_level', @sName, 'do_cancel', '_bx_reputation_form_level_input_do_cancel', '', 0, 'button', '_bx_reputation_form_level_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 1, 0);
  89. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  90. ('bx_reputation_level_add', 'name', 2147483647, 1, 1),
  91. ('bx_reputation_level_add', 'title', 2147483647, 1, 2),
  92. ('bx_reputation_level_add', 'icon', 2147483647, 1, 3),
  93. ('bx_reputation_level_add', 'points_in', 2147483647, 1, 4),
  94. ('bx_reputation_level_add', 'points_out', 2147483647, 1, 5),
  95. ('bx_reputation_level_add', 'controls', 2147483647, 1, 6),
  96. ('bx_reputation_level_add', 'do_submit', 2147483647, 1, 7),
  97. ('bx_reputation_level_add', 'do_cancel', 2147483647, 1, 8),
  98. ('bx_reputation_level_edit', 'title', 2147483647, 1, 1),
  99. ('bx_reputation_level_edit', 'icon', 2147483647, 1, 2),
  100. ('bx_reputation_level_edit', 'points_in', 2147483647, 1, 3),
  101. ('bx_reputation_level_edit', 'points_out', 2147483647, 1, 4),
  102. ('bx_reputation_level_edit', 'controls', 2147483647, 1, 5),
  103. ('bx_reputation_level_edit', 'do_submit', 2147483647, 1, 6),
  104. ('bx_reputation_level_edit', 'do_cancel', 2147483647, 1, 7);
  105. -- STUDIO PAGE & WIDGET
  106. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  107. (3, @sName, '_bx_reputation', '_bx_reputation', 'bx_reputation@modules/boonex/reputation/|std-icon.svg');
  108. SET @iPageId = LAST_INSERT_ID();
  109. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  110. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  111. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  112. (@iPageId, @sName, '{url_studio}module.php?name=bx_reputation', '', 'bx_reputation@modules/boonex/reputation/|std-icon.svg', '_bx_reputation', '', '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";}');
  113. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  114. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));