install.sql 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. SET @sName = 'bx_acl';
  2. -- TABLES
  3. CREATE TABLE `bx_acl_level_prices` (
  4. `id` int(11) NOT NULL auto_increment,
  5. `level_id` int(11) unsigned NOT NULL default '0',
  6. `name` varchar(128) NOT NULL default '',
  7. `period` int(11) unsigned NOT NULL default '1',
  8. `period_unit` varchar(32) NOT NULL default '',
  9. `trial` int(11) unsigned NOT NULL default '0',
  10. `price` float unsigned NOT NULL default '1',
  11. `order` int(11) NOT NULL,
  12. PRIMARY KEY (`id`),
  13. UNIQUE KEY `name` (`name`),
  14. UNIQUE KEY `type` (`level_id`,`period`, `period_unit`)
  15. );
  16. -- FORMS
  17. 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
  18. ('bx_acl_price', @sName, '_bx_acl_form_price', '', '', 'do_submit', 'bx_acl_level_prices', 'id', '', '', '', 0, 1, 'BxAclFormPrice', 'modules/boonex/acl/classes/BxAclFormPrice.php');
  19. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  20. ('bx_acl_price_add', @sName, 'bx_acl_price', '_bx_acl_form_price_display_add', 0),
  21. ('bx_acl_price_edit', @sName, 'bx_acl_price', '_bx_acl_form_price_display_edit', 0);
  22. 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
  23. ('bx_acl_price', @sName, 'id', '', '', 0, 'hidden', '_bx_acl_form_price_input_sys_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  24. ('bx_acl_price', @sName, 'level_id', '', '', 0, 'hidden', '_bx_acl_form_price_input_sys_level_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  25. ('bx_acl_price', @sName, 'name', '', '', 0, 'text', '_bx_acl_form_price_input_sys_name', '_bx_acl_form_price_input_name', '_bx_acl_form_price_input_inf_name', 1, 0, 0, '', '', '', 'Avail', '', '_bx_acl_form_price_input_err_name', 'Xss', '', 1, 0),
  26. ('bx_acl_price', @sName, 'period', '', '', 0, 'text', '_bx_acl_form_price_input_sys_period', '_bx_acl_form_price_input_period', '_bx_acl_form_price_input_inf_period', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  27. ('bx_acl_price', @sName, 'period_unit', '', '#!bx_acl_period_units', 0, 'select', '_bx_acl_form_price_input_sys_period_unit', '_bx_acl_form_price_input_period_unit', '_bx_acl_form_price_input_inf_period_unit', 1, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
  28. ('bx_acl_price', @sName, 'trial', '', '', 0, 'text', '_bx_acl_form_price_input_sys_trial', '_bx_acl_form_price_input_trial', '_bx_acl_form_price_input_inf_trial', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  29. ('bx_acl_price', @sName, 'price', '', '', 0, 'text', '_bx_acl_form_price_input_sys_price', '_bx_acl_form_price_input_price', '_bx_acl_form_price_input_inf_price', 1, 0, 0, '', '', '', '', '', '', 'Float', '', 1, 0),
  30. ('bx_acl_price', @sName, 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  31. ('bx_acl_price', @sName, 'do_submit', '_bx_acl_form_price_input_do_submit', '', 0, 'submit', '_bx_acl_form_price_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  32. ('bx_acl_price', @sName, 'do_cancel', '_bx_acl_form_price_input_do_cancel', '', 0, 'button', '_bx_acl_form_price_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);
  33. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  34. ('bx_acl_price_add', 'id', 2147483647, 0, 1),
  35. ('bx_acl_price_add', 'level_id', 2147483647, 1, 2),
  36. ('bx_acl_price_add', 'name', 2147483647, 1, 3),
  37. ('bx_acl_price_add', 'price', 2147483647, 1, 4),
  38. ('bx_acl_price_add', 'period', 2147483647, 1, 5),
  39. ('bx_acl_price_add', 'period_unit', 2147483647, 1, 6),
  40. ('bx_acl_price_add', 'trial', 2147483647, 1, 7),
  41. ('bx_acl_price_add', 'controls', 2147483647, 1, 8),
  42. ('bx_acl_price_add', 'do_submit', 2147483647, 1, 9),
  43. ('bx_acl_price_add', 'do_cancel', 2147483647, 1, 10),
  44. ('bx_acl_price_edit', 'id', 2147483647, 1, 1),
  45. ('bx_acl_price_edit', 'level_id', 2147483647, 1, 2),
  46. ('bx_acl_price_edit', 'name', 2147483647, 1, 3),
  47. ('bx_acl_price_edit', 'price', 2147483647, 1, 4),
  48. ('bx_acl_price_edit', 'period', 2147483647, 1, 5),
  49. ('bx_acl_price_edit', 'period_unit', 2147483647, 1, 6),
  50. ('bx_acl_price_edit', 'trial', 2147483647, 1, 7),
  51. ('bx_acl_price_edit', 'controls', 2147483647, 1, 8),
  52. ('bx_acl_price_edit', 'do_submit', 2147483647, 1, 9),
  53. ('bx_acl_price_edit', 'do_cancel', 2147483647, 1, 10);
  54. -- PRE-VALUES
  55. INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
  56. ('bx_acl_period_units', '_bx_acl_pre_lists_period_units', 'bx_acl', '0');
  57. INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
  58. ('bx_acl_period_units', '', 0, '_sys_please_select', ''),
  59. ('bx_acl_period_units', 'day', 1, '_bx_acl_pre_values_day', ''),
  60. ('bx_acl_period_units', 'week', 2, '_bx_acl_pre_values_week', ''),
  61. ('bx_acl_period_units', 'month', 3, '_bx_acl_pre_values_month', ''),
  62. ('bx_acl_period_units', 'year', 4, '_bx_acl_pre_values_year', '');
  63. -- GRIDS
  64. INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `sorting_fields`, `sorting_fields_translatable`, `visible_for_levels`, `override_class_name`, `override_class_file`) VALUES
  65. ('bx_acl_administration', 'Sql', 'SELECT * FROM `bx_acl_level_prices` WHERE 1 ', 'bx_acl_level_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 192, 'BxAclGridAdministration', 'modules/boonex/acl/classes/BxAclGridAdministration.php'),
  66. ('bx_acl_view', 'Sql', 'SELECT `tlp`.*, `tl`.`Name` AS `level_name`, `tl`.`Icon` AS `level_icon` FROM `bx_acl_level_prices` AS `tlp` LEFT JOIN `sys_acl_levels` AS `tl` ON `tlp`.`level_id`=`tl`.`ID` WHERE `tl`.`Active`=''yes'' AND `tl`.`Purchasable`=''yes'' ', 'bx_acl_level_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', 'tl`.`Name', 'like', '', '', 2147483647, 'BxAclGridView', 'modules/boonex/acl/classes/BxAclGridView.php');
  67. INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
  68. ('bx_acl_administration', 'checkbox', '_sys_select', '1%', 0, '', '', 1),
  69. ('bx_acl_administration', 'order', '', '1%', 0, '', '', 2),
  70. ('bx_acl_administration', 'name', '_bx_acl_grid_column_name', '33%', 0, 32, '', 3),
  71. ('bx_acl_administration', 'price', '_bx_acl_grid_column_price', '15%', 0, 16, '', 4),
  72. ('bx_acl_administration', 'period', '_bx_acl_grid_column_period', '15%', 0, 16, '', 5),
  73. ('bx_acl_administration', 'trial', '_bx_acl_grid_column_trial', '15%', 0, 16, '', 6),
  74. ('bx_acl_administration', 'actions', '', '20%', 0, '', '', 7),
  75. ('bx_acl_view', 'level_icon', '_bx_acl_grid_column_level_icon', '5%', 0, 0, '', 1),
  76. ('bx_acl_view', 'level_name', '_bx_acl_grid_column_level_name', '25%', 1, 32, '', 2),
  77. ('bx_acl_view', 'price', '_bx_acl_grid_column_price', '10%', 0, 16, '', 3),
  78. ('bx_acl_view', 'period', '_bx_acl_grid_column_period', '15%', 0, 16, '', 4),
  79. ('bx_acl_view', 'trial', '_bx_acl_grid_column_trial', '15%', 0, 16, '', 5),
  80. ('bx_acl_view', 'actions', '', '30%', 0, '', '', 6);
  81. INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
  82. ('bx_acl_administration', 'independent', 'add', '_bx_acl_grid_action_add', '', 0, 0, 1),
  83. ('bx_acl_administration', 'single', 'edit', '_bx_acl_grid_action_edit', 'pencil-alt', 1, 0, 1),
  84. ('bx_acl_administration', 'single', 'delete', '_bx_acl_grid_action_delete', 'remove', 1, 1, 2),
  85. ('bx_acl_administration', 'bulk', 'delete', '_bx_acl_grid_action_delete', '', 0, 1, 1),
  86. ('bx_acl_view', 'single', 'buy', '_bx_acl_grid_action_buy', 'cart-plus', 0, 0, 1),
  87. ('bx_acl_view', 'single', 'subscribe', '_bx_acl_grid_action_subscribe', 'credit-card', 0, 0, 2),
  88. ('bx_acl_view', 'single', 'choose', '_bx_acl_grid_action_choose', 'far check-square', 0, 0, 3);
  89. -- STUDIO PAGE & WIDGET
  90. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  91. (3, @sName, '_bx_acl', '_bx_acl', 'bx_acl@modules/boonex/acl/|std-icon.svg');
  92. SET @iPageId = LAST_INSERT_ID();
  93. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  94. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  95. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  96. (@iPageId, @sName, 'configuration', '{url_studio}module.php?name=bx_acl', '', 'bx_acl@modules/boonex/acl/|std-icon.svg', '_bx_acl', '', '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";}');
  97. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  98. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));