install.sql 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. SET @sStorageEngine = (SELECT `value` FROM `sys_options` WHERE `name` = 'sys_storage_default');
  2. -- TABLE: PROFILES
  3. CREATE TABLE IF NOT EXISTS `bx_organizations_data` (
  4. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  5. `author` int(10) unsigned NOT NULL,
  6. `added` int(11) NOT NULL,
  7. `changed` int(11) NOT NULL,
  8. `picture` int(11) NOT NULL,
  9. `cover` int(11) NOT NULL,
  10. `org_name` varchar(255) NOT NULL,
  11. `org_cat` int(11) NOT NULL,
  12. `org_desc` text NOT NULL,
  13. `views` int(11) NOT NULL default '0',
  14. `favorites` int(11) NOT NULL default '0',
  15. `reports` int(11) NOT NULL default '0',
  16. `allow_view_to` int(11) NOT NULL DEFAULT '3',
  17. PRIMARY KEY (`id`),
  18. FULLTEXT KEY `search_fields` (`org_name`,`org_desc`)
  19. );
  20. -- TABLE: STORAGES & TRANSCODERS
  21. CREATE TABLE IF NOT EXISTS `bx_organizations_pics` (
  22. `id` int(11) NOT NULL AUTO_INCREMENT,
  23. `profile_id` int(10) unsigned NOT NULL,
  24. `remote_id` varchar(128) NOT NULL,
  25. `path` varchar(255) NOT NULL,
  26. `file_name` varchar(255) NOT NULL,
  27. `mime_type` varchar(128) NOT NULL,
  28. `ext` varchar(32) NOT NULL,
  29. `size` int(11) NOT NULL,
  30. `added` int(11) NOT NULL,
  31. `modified` int(11) NOT NULL,
  32. `private` int(11) NOT NULL,
  33. PRIMARY KEY (`id`),
  34. UNIQUE KEY `remote_id` (`remote_id`)
  35. );
  36. CREATE TABLE IF NOT EXISTS `bx_organizations_pics_resized` (
  37. `id` int(11) NOT NULL AUTO_INCREMENT,
  38. `profile_id` int(10) unsigned NOT NULL,
  39. `remote_id` varchar(128) NOT NULL,
  40. `path` varchar(255) NOT NULL,
  41. `file_name` varchar(255) NOT NULL,
  42. `mime_type` varchar(128) NOT NULL,
  43. `ext` varchar(32) NOT NULL,
  44. `size` int(11) NOT NULL,
  45. `added` int(11) NOT NULL,
  46. `modified` int(11) NOT NULL,
  47. `private` int(11) NOT NULL,
  48. PRIMARY KEY (`id`),
  49. UNIQUE KEY `remote_id` (`remote_id`)
  50. );
  51. -- TABLE: VIEWS
  52. CREATE TABLE IF NOT EXISTS `bx_organizations_views_track` (
  53. `object_id` int(11) NOT NULL default '0',
  54. `viewer_id` int(11) NOT NULL default '0',
  55. `viewer_nip` int(11) unsigned NOT NULL default '0',
  56. `date` int(11) NOT NULL default '0',
  57. KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
  58. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  59. -- TABLE: favorites
  60. CREATE TABLE IF NOT EXISTS `bx_organizations_favorites_track` (
  61. `object_id` int(11) NOT NULL default '0',
  62. `author_id` int(11) NOT NULL default '0',
  63. `date` int(11) NOT NULL default '0',
  64. KEY `id` (`object_id`,`author_id`)
  65. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  66. -- TABLE: reports
  67. CREATE TABLE IF NOT EXISTS `bx_organizations_reports` (
  68. `object_id` int(11) NOT NULL default '0',
  69. `count` int(11) NOT NULL default '0',
  70. UNIQUE KEY `object_id` (`object_id`)
  71. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  72. CREATE TABLE IF NOT EXISTS `bx_organizations_reports_track` (
  73. `id` int(11) NOT NULL AUTO_INCREMENT,
  74. `object_id` int(11) NOT NULL default '0',
  75. `author_id` int(11) NOT NULL default '0',
  76. `author_nip` int(11) unsigned NOT NULL default '0',
  77. `type` varchar(32) NOT NULL default '',
  78. `text` text NOT NULL default '',
  79. `date` int(11) NOT NULL default '0',
  80. PRIMARY KEY (`id`),
  81. KEY `report` (`object_id`, `author_nip`)
  82. ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
  83. -- TABLE: metas
  84. CREATE TABLE IF NOT EXISTS `bx_organizations_meta_keywords` (
  85. `object_id` int(10) unsigned NOT NULL,
  86. `keyword` varchar(255) NOT NULL,
  87. KEY `object_id` (`object_id`),
  88. KEY `keyword` (`keyword`)
  89. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  90. -- STORAGES & TRANSCODERS
  91. INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
  92. ('bx_organizations_pics', @sStorageEngine, '', 360, 2592000, 3, 'bx_organizations_pics', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
  93. ('bx_organizations_pics_resized', @sStorageEngine, '', 360, 2592000, 3, 'bx_organizations_pics_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
  94. INSERT INTO `sys_objects_transcoder` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
  95. ('bx_organizations_icon', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
  96. ('bx_organizations_thumb', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
  97. ('bx_organizations_avatar', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
  98. ('bx_organizations_picture', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
  99. ('bx_organizations_cover', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
  100. ('bx_organizations_cover_thumb', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0');
  101. INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
  102. ('bx_organizations_icon', 'Resize', 'a:3:{s:1:"w";s:2:"32";s:1:"h";s:2:"32";s:13:"square_resize";s:1:"1";}', '0'),
  103. ('bx_organizations_thumb', 'Resize', 'a:3:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";}', '0'),
  104. ('bx_organizations_avatar', 'Resize', 'a:3:{s:1:"w";s:2:"96";s:1:"h";s:2:"96";s:13:"square_resize";s:1:"1";}', '0'),
  105. ('bx_organizations_picture', 'Resize', 'a:3:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"0";}', '0'),
  106. ('bx_organizations_cover', 'Resize', 'a:1:{s:1:"w";s:4:"1024";}', '0'),
  107. ('bx_organizations_cover_thumb', 'Resize', 'a:3:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";}', '0');
  108. -- FORMS
  109. INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  110. ('bx_organization', 'bx_organizations', '_bx_orgs_form_profile', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_organizations_data', 'id', '', '', 'do_submit', '', 0, 1, 'BxOrgsFormEntry', 'modules/boonex/organizations/classes/BxOrgsFormEntry.php');
  111. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  112. ('bx_organization', 'bx_organization_add', 'bx_organizations', 0, '_bx_orgs_form_profile_display_add'),
  113. ('bx_organization', 'bx_organization_delete', 'bx_organizations', 0, '_bx_orgs_form_profile_display_delete'),
  114. ('bx_organization', 'bx_organization_edit', 'bx_organizations', 0, '_bx_orgs_form_profile_display_edit'),
  115. ('bx_organization', 'bx_organization_edit_cover', 'bx_organizations', 0, '_bx_orgs_form_profile_display_edit_cover'),
  116. ('bx_organization', 'bx_organization_view', 'bx_organizations', 1, '_bx_orgs_form_profile_display_view'),
  117. ('bx_organization', 'bx_organization_view_full', 'bx_organizations', 1, '_bx_orgs_form_profile_display_view_full');
  118. 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
  119. ('bx_organization', 'bx_organizations', 'allow_view_to', 3, '', 0, 'custom', '_bx_orgs_form_profile_input_sys_allow_view_to', '_bx_orgs_form_profile_input_allow_view_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  120. ('bx_organization', 'bx_organizations', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_orgs_form_profile_input_sys_delete_confirm', '_bx_orgs_form_profile_input_delete_confirm', '_bx_orgs_form_profile_input_delete_confirm_info', 1, 0, 0, '', '', '', 'avail', '', '_bx_orgs_form_profile_input_delete_confirm_error', '', '', 1, 0),
  121. ('bx_organization', 'bx_organizations', 'do_submit', '_sys_form_account_input_submit', '', 0, 'submit', '_bx_orgs_form_profile_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  122. ('bx_organization', 'bx_organizations', 'org_desc', '', '', 0, 'textarea', '_bx_orgs_form_profile_input_sys_org_desc', '_bx_orgs_form_profile_input_org_desc', '', 0, 0, 0, '', '', '', '', '', '', 'XssMultiline', '', 1, 1),
  123. ('bx_organization', 'bx_organizations', 'org_cat', '', '#!bx_organizations_cats', 0, 'select', '_bx_orgs_form_profile_input_sys_org_cat', '_bx_orgs_form_profile_input_org_cat', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_orgs_form_profile_input_org_cat_err', 'Xss', '', 1, 1),
  124. ('bx_organization', 'bx_organizations', 'org_name', '', '', 0, 'text', '_bx_orgs_form_profile_input_sys_org_name', '_bx_orgs_form_profile_input_org_name', '', 1, 0, 0, '', '', '', 'avail', '', '_bx_orgs_form_profile_input_org_name_err', 'Xss', '', 1, 0),
  125. ('bx_organization', 'bx_organizations', 'cover', 'a:1:{i:0;s:27:"bx_organizations_cover_crop";}', 'a:1:{s:27:"bx_organizations_cover_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_orgs_form_profile_input_sys_cover', '_bx_orgs_form_profile_input_cover', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  126. ('bx_organization', 'bx_organizations', 'picture', 'a:1:{i:0;s:29:"bx_organizations_picture_crop";}', 'a:1:{s:29:"bx_organizations_picture_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_orgs_form_profile_input_sys_picture', '_bx_orgs_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_orgs_form_profile_input_picture_err', '', '', 1, 0);
  127. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  128. ('bx_organization_add', 'delete_confirm', 2147483647, 0, 3),
  129. ('bx_organization_add', 'cover', 2147483647, 0, 4),
  130. ('bx_organization_add', 'picture', 2147483647, 1, 5),
  131. ('bx_organization_add', 'org_name', 2147483647, 1, 6),
  132. ('bx_organization_add', 'org_cat', 2147483647, 1, 7),
  133. ('bx_organization_add', 'org_desc', 2147483647, 1, 8),
  134. ('bx_organization_add', 'allow_view_to', 2147483647, 1, 9),
  135. ('bx_organization_add', 'do_submit', 2147483647, 1, 10),
  136. ('bx_organization_delete', 'picture', 2147483647, 0, 0),
  137. ('bx_organization_delete', 'delete_confirm', 2147483647, 1, 0),
  138. ('bx_organization_delete', 'cover', 2147483647, 0, 0),
  139. ('bx_organization_delete', 'do_submit', 2147483647, 1, 1),
  140. ('bx_organization_delete', 'org_name', 2147483647, 0, 2),
  141. ('bx_organization_delete', 'org_cat', 2147483647, 0, 3),
  142. ('bx_organization_edit', 'delete_confirm', 2147483647, 0, 2),
  143. ('bx_organization_edit', 'cover', 2147483647, 0, 3),
  144. ('bx_organization_edit', 'picture', 2147483647, 1, 5),
  145. ('bx_organization_edit', 'org_name', 2147483647, 1, 6),
  146. ('bx_organization_edit', 'org_cat', 2147483647, 1, 7),
  147. ('bx_organization_edit', 'org_desc', 2147483647, 1, 8),
  148. ('bx_organization_edit', 'allow_view_to', 2147483647, 1, 9),
  149. ('bx_organization_edit', 'do_submit', 2147483647, 1, 10),
  150. ('bx_organization_edit_cover', 'delete_confirm', 2147483647, 0, 1),
  151. ('bx_organization_edit_cover', 'org_name', 2147483647, 0, 2),
  152. ('bx_organization_edit_cover', 'picture', 2147483647, 0, 3),
  153. ('bx_organization_edit_cover', 'org_cat', 2147483647, 0, 5),
  154. ('bx_organization_edit_cover', 'cover', 2147483647, 1, 7),
  155. ('bx_organization_edit_cover', 'do_submit', 2147483647, 1, 8),
  156. ('bx_organization_view', 'delete_confirm', 2147483647, 0, 3),
  157. ('bx_organization_view', 'picture', 2147483647, 0, 4),
  158. ('bx_organization_view', 'cover', 2147483647, 0, 5),
  159. ('bx_organization_view', 'do_submit', 2147483647, 0, 6),
  160. ('bx_organization_view', 'org_name', 2147483647, 1, 7),
  161. ('bx_organization_view', 'org_cat', 2147483647, 1, 8),
  162. ('bx_organization_view', 'org_desc', 2147483647, 0, 9),
  163. ('bx_organization_view_full', 'org_name', 2147483647, 1, 1),
  164. ('bx_organization_view_full', 'org_cat', 2147483647, 1, 2),
  165. ('bx_organization_view_full', 'org_desc', 2147483647, 1, 3);
  166. -- PRE-VALUES
  167. INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
  168. ('bx_organizations_cats', '_bx_orgs_pre_lists_cats', 'bx_organizations', '0');
  169. INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
  170. ('bx_organizations_cats', '', 0, '_sys_please_select', ''),
  171. ('bx_organizations_cats', '1', 1, '_bx_orgs_cat_Agriculture', ''),
  172. ('bx_organizations_cats', '2', 2, '_bx_orgs_cat_Financial', ''),
  173. ('bx_organizations_cats', '3', 3, '_bx_orgs_cat_Biotech', ''),
  174. ('bx_organizations_cats', '4', 4, '_bx_orgs_cat_Cause', ''),
  175. ('bx_organizations_cats', '5', 5, '_bx_orgs_cat_Chemical', ''),
  176. ('bx_organizations_cats', '6', 6, '_bx_orgs_cat_Religious', ''),
  177. ('bx_organizations_cats', '7', 7, '_bx_orgs_cat_Community', ''),
  178. ('bx_organizations_cats', '8', 8, '_bx_orgs_cat_Company', ''),
  179. ('bx_organizations_cats', '9', 9, '_bx_orgs_cat_Entertainment', ''),
  180. ('bx_organizations_cats', '10', 10, '_bx_orgs_cat_Technology', ''),
  181. ('bx_organizations_cats', '11', 11, '_bx_orgs_cat_Consulting', ''),
  182. ('bx_organizations_cats', '12', 12, '_bx_orgs_cat_Education', ''),
  183. ('bx_organizations_cats', '13', 13, '_bx_orgs_cat_Energy', ''),
  184. ('bx_organizations_cats', '14', 14, '_bx_orgs_cat_Engineering', ''),
  185. ('bx_organizations_cats', '15', 15, '_bx_orgs_cat_Food', ''),
  186. ('bx_organizations_cats', '16', 16, '_bx_orgs_cat_Government', ''),
  187. ('bx_organizations_cats', '17', 17, '_bx_orgs_cat_Health', ''),
  188. ('bx_organizations_cats', '18', 18, '_bx_orgs_cat_Medical', ''),
  189. ('bx_organizations_cats', '19', 19, '_bx_orgs_cat_Industrial', ''),
  190. ('bx_organizations_cats', '20', 20, '_bx_orgs_cat_Insurance', ''),
  191. ('bx_organizations_cats', '21', 21, '_bx_orgs_cat_Internet', ''),
  192. ('bx_organizations_cats', '22', 22, '_bx_orgs_cat_Software', ''),
  193. ('bx_organizations_cats', '23', 23, '_bx_orgs_cat_Legal', ''),
  194. ('bx_organizations_cats', '24', 24, '_bx_orgs_cat_Media', ''),
  195. ('bx_organizations_cats', '25', 25, '_bx_orgs_cat_School', ''),
  196. ('bx_organizations_cats', '26', 26, '_bx_orgs_cat_NGO', ''),
  197. ('bx_organizations_cats', '27', 27, '_bx_orgs_cat_NPO', ''),
  198. ('bx_organizations_cats', '28', 28, '_bx_orgs_cat_Political', ''),
  199. ('bx_organizations_cats', '29', 29, '_bx_orgs_cat_Retail', ''),
  200. ('bx_organizations_cats', '30', 30, '_bx_orgs_cat_Small_Business', ''),
  201. ('bx_organizations_cats', '31', 31, '_bx_orgs_cat_Telecommunication', ''),
  202. ('bx_organizations_cats', '32', 32, '_bx_orgs_cat_Transport', ''),
  203. ('bx_organizations_cats', '33', 33, '_bx_orgs_cat_Travel', ''),
  204. ('bx_organizations_cats', '34', 34, '_bx_orgs_cat_University', ''),
  205. ('bx_organizations_cats', '35', 35, '_bx_orgs_cat_Other', '');
  206. -- STUDIO PAGE & WIDGET
  207. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  208. (3, 'bx_organizations', '_bx_orgs', '_bx_orgs', 'bx_organizations@modules/boonex/organizations/|std-icon.svg');
  209. SET @iPageId = LAST_INSERT_ID();
  210. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  211. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  212. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  213. (@iPageId, 'bx_organizations', '{url_studio}module.php?name=bx_organizations', '', 'bx_organizations@modules/boonex/organizations/|std-icon.svg', '_bx_orgs', '', '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";}');
  214. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  215. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));