install.sql 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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: profiles
  30. CREATE TABLE IF NOT EXISTS `bx_reputation_profiles` (
  31. `id` int(11) NOT NULL DEFAULT '0',
  32. `points` int(11) NOT NULL DEFAULT '0',
  33. PRIMARY KEY (`id`)
  34. );
  35. -- FORMS: handler
  36. 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
  37. ('bx_reputation_handler', @sName, '_bx_reputation_form_handler', '', '', 'do_submit', 'bx_reputation_handlers', 'id', '', '', '', 0, 1, '', '');
  38. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  39. ('bx_reputation_handler_edit', @sName, 'bx_reputation_handler', '_bx_reputation_form_handler_display_edit', 0);
  40. 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
  41. ('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),
  42. ('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),
  43. ('bx_reputation_handler', @sName, 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '_bx_reputation_form_handler_input_sys_controls', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  44. ('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),
  45. ('bx_reputation_handler', @sName, 'do_cancel', '_bx_reputation_form_handler_input_do_cancel', '', 0, 'button', '_bx_reputation_form_handler_input_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);
  46. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  47. ('bx_reputation_handler_edit', 'points_active', 2147483647, 1, 1),
  48. ('bx_reputation_handler_edit', 'points_passive', 2147483647, 1, 2),
  49. ('bx_reputation_handler_edit', 'controls', 2147483647, 1, 3),
  50. ('bx_reputation_handler_edit', 'do_submit', 2147483647, 1, 4),
  51. ('bx_reputation_handler_edit', 'do_cancel', 2147483647, 1, 5);
  52. -- STUDIO PAGE & WIDGET
  53. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  54. (3, @sName, '_bx_reputation', '_bx_reputation', 'bx_reputation@modules/boonex/reputation/|std-icon.svg');
  55. SET @iPageId = LAST_INSERT_ID();
  56. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  57. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  58. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  59. (@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";}');
  60. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  61. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));