1
0

install.sql 6.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. SET @sName = 'bx_github';
  2. -- TABLE: apps
  3. CREATE TABLE IF NOT EXISTS `bx_github_apps` (
  4. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  5. `profile_id` int(11) unsigned NOT NULL DEFAULT 0,
  6. `added` int(11) NOT NULL DEFAULT 0,
  7. `title` varchar(128) NOT NULL DEFAULT '',
  8. `client_id` varchar(64) NOT NULL DEFAULT '',
  9. `client_secret` varchar(64) NOT NULL DEFAULT '',
  10. PRIMARY KEY (`id`),
  11. UNIQUE KEY `app` (`profile_id`, `client_id`)
  12. );
  13. -- TABLE: authorizations
  14. CREATE TABLE IF NOT EXISTS `bx_github_authorizations` (
  15. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  16. `profile_id` int(11) unsigned NOT NULL DEFAULT 0,
  17. `app_id` int(11) unsigned NOT NULL DEFAULT 0,
  18. `added` int(11) NOT NULL DEFAULT 0,
  19. `changed` int(11) NOT NULL DEFAULT 0,
  20. `access_token` varchar(128) NOT NULL DEFAULT '',
  21. `at_expires_in` int(11) NOT NULL DEFAULT 0,
  22. `refresh_token` varchar(128) NOT NULL DEFAULT '',
  23. `rt_expires_in` int(11) NOT NULL DEFAULT 0,
  24. PRIMARY KEY (`id`),
  25. UNIQUE KEY `authorization` (`profile_id`, `app_id`)
  26. );
  27. -- TABLE: settings
  28. CREATE TABLE IF NOT EXISTS `bx_github_settings` (
  29. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  30. `profile_id` int(11) unsigned NOT NULL DEFAULT 0,
  31. `pat` varchar(64) NOT NULL DEFAULT '',
  32. PRIMARY KEY (`id`),
  33. UNIQUE KEY `profile_id` (`profile_id`)
  34. );
  35. -- FORMS: Apps
  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_github_form_apps', @sName, '_bx_github_form_apps', '', '', 'do_submit', 'bx_github_apps', 'id', '', '', '', 0, 1, 'BxGitHubFormApps', 'modules/boonex/github/classes/BxGitHubFormApps.php');
  38. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  39. ('bx_github_form_apps_add', @sName, 'bx_github_form_apps', '_bx_github_form_apps_display_add', 0),
  40. ('bx_github_form_apps_edit', @sName, 'bx_github_form_apps', '_bx_github_form_apps_display_edit', 0);
  41. 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
  42. ('bx_github_form_apps', @sName, 'title', '', '', 0, 'text', '_bx_github_form_apps_input_sys_title', '_bx_github_form_apps_input_title', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
  43. ('bx_github_form_apps', @sName, 'client_id', '', '', 0, 'text', '_bx_github_form_apps_input_sys_client_id', '_bx_github_form_apps_input_client_id', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  44. ('bx_github_form_apps', @sName, 'client_secret', '', '', 0, 'text', '_bx_github_form_apps_input_sys_client_secret', '_bx_github_form_apps_input_client_secret', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  45. ('bx_github_form_apps', @sName, 'do_submit', '_bx_github_form_apps_input_do_submit', '', 0, 'submit', '_bx_github_form_apps_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
  46. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  47. ('bx_github_form_apps_add', 'title', 2147483647, 1, 1),
  48. ('bx_github_form_apps_add', 'client_id', 2147483647, 1, 2),
  49. ('bx_github_form_apps_add', 'client_secret', 2147483647, 1, 3),
  50. ('bx_github_form_apps_add', 'do_submit', 2147483647, 1, 4),
  51. ('bx_github_form_apps_edit', 'title', 2147483647, 1, 1),
  52. ('bx_github_form_apps_edit', 'client_id', 2147483647, 1, 2),
  53. ('bx_github_form_apps_edit', 'client_secret', 2147483647, 1, 3),
  54. ('bx_github_form_apps_edit', 'do_submit', 2147483647, 1, 4);
  55. -- FORMS: Settings
  56. 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
  57. ('bx_github_form_settings', @sName, '_bx_github_form_settings', '', '', 'do_submit', 'bx_github_settings', 'id', '', '', '', 0, 1, 'BxGitHubFormSettings', 'modules/boonex/github/classes/BxGitHubFormSettings.php');
  58. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  59. ('bx_github_form_settings_edit', @sName, 'bx_github_form_settings', '_bx_github_form_settings_display_edit_client_pat', 0);
  60. 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
  61. ('bx_github_form_settings', @sName, 'pat', '', '', 0, 'text', '_bx_github_form_settings_input_sys_pat', '_bx_github_form_settings_input_pat', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
  62. ('bx_github_form_settings', @sName, 'do_submit', '_bx_github_form_settings_input_do_submit', '', 0, 'submit', '_bx_github_form_settings_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
  63. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  64. ('bx_github_form_settings_edit', 'pat', 2147483647, 1, 1),
  65. ('bx_github_form_settings_edit', 'do_submit', 2147483647, 1, 2);
  66. -- LOGS
  67. INSERT INTO `sys_objects_logs` (`object`, `module`, `logs_storage`, `title`, `active`, `class_name`, `class_file`) VALUES
  68. ('bx_github_api', @sName, 'Auto', '_bx_github_log_api', 1, '', '');
  69. -- STUDIO PAGE & WIDGET
  70. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  71. (3, @sName, '_bx_github', '_bx_github', 'bx_github@modules/boonex/github/|std-icon.svg');
  72. SET @iPageId = LAST_INSERT_ID();
  73. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  74. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  75. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  76. (@iPageId, @sName, '{url_studio}module.php?name=bx_github', '', 'bx_github@modules/boonex/github/|std-icon.svg', '_bx_github', '', '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";}');
  77. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  78. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));