install.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. `caption` varchar(128) NOT NULL default '',
  8. `description` text NOT NULL,
  9. `details` text NOT NULL,
  10. `period` int(11) unsigned NOT NULL default '1',
  11. `period_unit` varchar(32) NOT NULL default '',
  12. `trial` int(11) unsigned NOT NULL default '0',
  13. `price` float unsigned NOT NULL default '1',
  14. `immediate` tinyint(4) NOT NULL default '1',
  15. `added` int(11) NOT NULL default '0',
  16. `active` tinyint(4) NOT NULL default '1',
  17. `order` int(11) NOT NULL,
  18. PRIMARY KEY (`id`),
  19. UNIQUE KEY `name` (`name`)
  20. );
  21. INSERT INTO `bx_acl_level_prices` (`level_id`, `name`, `caption`, `description`, `details`, `period`, `period_unit`, `trial`, `price`, `immediate`, `added`, `active`, `order`) VALUES
  22. (3, 'standard', '_bx_acl_txt_level_caption_standard', '_bx_acl_txt_level_description_standard', '_bx_acl_txt_level_details_standard', 0, '', 0, 0, 1, UNIX_TIMESTAMP(), 0, 1);
  23. -- TABLE: licenses
  24. CREATE TABLE IF NOT EXISTS `bx_acl_licenses` (
  25. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  26. `profile_id` int(11) unsigned NOT NULL default '0',
  27. `price_id` int(11) unsigned NOT NULL default '0',
  28. `type` varchar(16) NOT NULL default 'single',
  29. `order` varchar(32) NOT NULL default '',
  30. `license` varchar(32) NOT NULL default '',
  31. `added` int(11) unsigned NOT NULL default '0',
  32. PRIMARY KEY (`id`),
  33. KEY `price_id` (`price_id`, `profile_id`),
  34. KEY `license` (`license`)
  35. );
  36. -- FORMS
  37. 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
  38. ('bx_acl_price', @sName, '_bx_acl_form_price', '', '', 'do_submit', 'bx_acl_level_prices', 'id', '', '', '', 0, 1, 'BxAclFormPrice', 'modules/boonex/acl/classes/BxAclFormPrice.php');
  39. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  40. ('bx_acl_price_add', @sName, 'bx_acl_price', '_bx_acl_form_price_display_add', 0),
  41. ('bx_acl_price_edit', @sName, 'bx_acl_price', '_bx_acl_form_price_display_edit', 0);
  42. 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
  43. ('bx_acl_price', @sName, 'id', '', '', 0, 'hidden', '_bx_acl_form_price_input_sys_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  44. ('bx_acl_price', @sName, 'level_id', '', '', 0, 'select', '_bx_acl_form_price_input_sys_level_id', '_bx_acl_form_price_input_level_id', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_acl_form_price_input_err_level_id', 'Int', '', 1, 0),
  45. ('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),
  46. ('bx_acl_price', @sName, 'caption', '0', '', 0, 'text_translatable', '_bx_acl_form_price_input_sys_caption', '_bx_acl_form_price_input_caption', '_bx_acl_form_price_input_inf_caption', 1, 0, 0, '', '', '', 'AvailTranslatable', 'a:1:{i:0;s:7:"caption";}', '_bx_acl_form_price_input_err_caption', 'Xss', '', 0, 0),
  47. ('bx_acl_price', @sName, 'description', '0', '', 0, 'textarea_translatable', '_bx_acl_form_price_input_sys_description', '_bx_acl_form_price_input_description', '', 0, 0, 3, '', '', '', '', '', '', 'Xss', '', 0, 0),
  48. ('bx_acl_price', @sName, 'details', '0', '', 0, 'textarea_translatable', '_bx_acl_form_price_input_sys_details', '_bx_acl_form_price_input_details', '', 0, 0, 3, '', '', '', '', '', '', 'Xss', '', 0, 0),
  49. ('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),
  50. ('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),
  51. ('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),
  52. ('bx_acl_price', @sName, 'price', '', '', 0, 'price', '_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),
  53. ('bx_acl_price', @sName, 'immediate', 1, '', 1, 'switcher', '_bx_acl_form_price_input_sys_immediate', '_bx_acl_form_price_input_immediate', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  54. ('bx_acl_price', @sName, 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  55. ('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),
  56. ('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);
  57. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  58. ('bx_acl_price_add', 'id', 2147483647, 0, 1),
  59. ('bx_acl_price_add', 'level_id', 2147483647, 1, 2),
  60. ('bx_acl_price_add', 'name', 2147483647, 1, 3),
  61. ('bx_acl_price_add', 'caption', 2147483647, 1, 4),
  62. ('bx_acl_price_add', 'description', 2147483647, 1, 5),
  63. ('bx_acl_price_add', 'details', 2147483647, 1, 6),
  64. ('bx_acl_price_add', 'price', 2147483647, 1, 7),
  65. ('bx_acl_price_add', 'period', 2147483647, 1, 8),
  66. ('bx_acl_price_add', 'period_unit', 2147483647, 1, 9),
  67. ('bx_acl_price_add', 'trial', 2147483647, 1, 10),
  68. ('bx_acl_price_add', 'immediate', 2147483647, 1, 11),
  69. ('bx_acl_price_add', 'controls', 2147483647, 1, 12),
  70. ('bx_acl_price_add', 'do_submit', 2147483647, 1, 13),
  71. ('bx_acl_price_add', 'do_cancel', 2147483647, 1, 14),
  72. ('bx_acl_price_edit', 'id', 2147483647, 1, 1),
  73. ('bx_acl_price_edit', 'level_id', 2147483647, 1, 2),
  74. ('bx_acl_price_edit', 'name', 2147483647, 1, 3),
  75. ('bx_acl_price_edit', 'caption', 2147483647, 1, 4),
  76. ('bx_acl_price_edit', 'description', 2147483647, 1, 5),
  77. ('bx_acl_price_edit', 'details', 2147483647, 1, 6),
  78. ('bx_acl_price_edit', 'price', 2147483647, 1, 7),
  79. ('bx_acl_price_edit', 'period', 2147483647, 1, 8),
  80. ('bx_acl_price_edit', 'period_unit', 2147483647, 1, 9),
  81. ('bx_acl_price_edit', 'trial', 2147483647, 1, 10),
  82. ('bx_acl_price_edit', 'immediate', 2147483647, 1, 11),
  83. ('bx_acl_price_edit', 'controls', 2147483647, 1, 12),
  84. ('bx_acl_price_edit', 'do_submit', 2147483647, 1, 13),
  85. ('bx_acl_price_edit', 'do_cancel', 2147483647, 1, 14);
  86. -- PRE-VALUES
  87. INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
  88. ('bx_acl_period_units', '_bx_acl_pre_lists_period_units', 'bx_acl', '0');
  89. INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
  90. ('bx_acl_period_units', '', 0, '_sys_please_select', ''),
  91. ('bx_acl_period_units', 'day', 1, '_bx_acl_pre_values_day', ''),
  92. ('bx_acl_period_units', 'week', 2, '_bx_acl_pre_values_week', ''),
  93. ('bx_acl_period_units', 'month', 3, '_bx_acl_pre_values_month', ''),
  94. ('bx_acl_period_units', 'year', 4, '_bx_acl_pre_values_year', '');
  95. -- GRIDS
  96. 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
  97. ('bx_acl_administration', 'Sql', 'SELECT * FROM `bx_acl_level_prices` WHERE 1 ', 'bx_acl_level_prices', 'id', 'order', 'active', '', 100, NULL, 'start', '', 'period,period_unit,price', 'caption', 'like', '', '', 192, 'BxAclGridAdministration', 'modules/boonex/acl/classes/BxAclGridAdministration.php'),
  98. ('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 `tlp`.`active`<>''0'' && `tl`.`Active`=''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');
  99. INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
  100. ('bx_acl_administration', 'checkbox', '_sys_select', '2%', 0, '', '', 1),
  101. ('bx_acl_administration', 'order', '', '2%', 0, '', '', 2),
  102. ('bx_acl_administration', 'switcher', '', '6%', 0, '', '', 3),
  103. ('bx_acl_administration', 'level_id', '_bx_acl_grid_column_level_id', '10%', 0, 16, '', 4),
  104. ('bx_acl_administration', 'name', '_bx_acl_grid_column_name', '10%', 0, 16, '', 5),
  105. ('bx_acl_administration', 'caption', '_bx_acl_grid_column_caption', '10%', 1, 16, '', 6),
  106. ('bx_acl_administration', 'description', '_bx_acl_grid_column_description', '8%', 1, 8, '', 7),
  107. ('bx_acl_administration', 'details', '_bx_acl_grid_column_details', '8%', 1, 8, '', 8),
  108. ('bx_acl_administration', 'price', '_bx_acl_grid_column_price', '8%', 0, 16, '', 9),
  109. ('bx_acl_administration', 'period', '_bx_acl_grid_column_period', '8%', 0, 16, '', 10),
  110. ('bx_acl_administration', 'trial', '_bx_acl_grid_column_trial', '8%', 0, 16, '', 11),
  111. ('bx_acl_administration', 'actions', '', '20%', 0, '', '', 12),
  112. ('bx_acl_view', 'level_icon', '_bx_acl_grid_column_level_icon', '5%', 0, 0, '', 1),
  113. ('bx_acl_view', 'level_name', '_bx_acl_grid_column_level_name', '25%', 1, 32, '', 2),
  114. ('bx_acl_view', 'description', '_bx_acl_grid_column_description', '10%', 1, 8, '', 3),
  115. ('bx_acl_view', 'details', '_bx_acl_grid_column_details', '10%', 1, 8, '', 4),
  116. ('bx_acl_view', 'price', '_bx_acl_grid_column_price', '10%', 0, 16, '', 5),
  117. ('bx_acl_view', 'period', '_bx_acl_grid_column_period', '10%', 0, 16, '', 6),
  118. ('bx_acl_view', 'trial', '_bx_acl_grid_column_trial', '10%', 0, 16, '', 7),
  119. ('bx_acl_view', 'actions', '', '20%', 0, '', '', 8);
  120. INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
  121. ('bx_acl_administration', 'independent', 'add', '_bx_acl_grid_action_add', '', 0, 0, 1),
  122. ('bx_acl_administration', 'single', 'edit', '_bx_acl_grid_action_edit', 'pencil-alt', 1, 0, 1),
  123. ('bx_acl_administration', 'single', 'delete', '_bx_acl_grid_action_delete', 'remove', 1, 1, 2),
  124. ('bx_acl_administration', 'bulk', 'delete', '_bx_acl_grid_action_delete', '', 0, 1, 1),
  125. ('bx_acl_view', 'single', 'buy', '_bx_acl_grid_action_buy', 'cart-plus', 0, 0, 1),
  126. ('bx_acl_view', 'single', 'subscribe', '_bx_acl_grid_action_subscribe', 'credit-card', 0, 0, 2),
  127. ('bx_acl_view', 'single', 'choose', '_bx_acl_grid_action_choose', 'far check-square', 0, 0, 3);
  128. -- STUDIO PAGE & WIDGET
  129. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  130. (3, @sName, '_bx_acl', '_bx_acl', 'bx_acl@modules/boonex/acl/|std-icon.svg');
  131. SET @iPageId = LAST_INSERT_ID();
  132. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  133. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  134. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  135. (@iPageId, @sName, 'users', '{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";}');
  136. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  137. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));