enable.sql 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. -- SETTINGS
  2. SET @iTypeOrder = (SELECT MAX(`order`) FROM `sys_options_types` WHERE `group` = 'modules');
  3. INSERT INTO `sys_options_types`(`group`, `name`, `caption`, `icon`, `order`) VALUES
  4. ('modules', 'bx_notes', '_bx_notes', 'bx_notes@modules/boonex/notes/|std-mi.png', IF(ISNULL(@iTypeOrder), 1, @iTypeOrder + 1));
  5. SET @iTypeId = LAST_INSERT_ID();
  6. INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `order`)
  7. VALUES (@iTypeId, 'bx_notes', '_bx_notes', 1);
  8. SET @iCategId = LAST_INSERT_ID();
  9. INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_error`, `extra`, `order`) VALUES
  10. ('bx_notes_autoapproval', 'on', @iCategId, 'Activate notes after creation automatically', 'checkbox', '', '', '', 1),
  11. ('bx_notes_summary_chars', '700', @iCategId, 'Number of characters in auto-cropped note summary', 'digit', '', '', '', 2);
  12. -- STORAGES & TRANSCODERS
  13. SET @iTotalFilesSize = (SELECT SUM(`size`) FROM `bx_notes_photos`);
  14. SET @iTotalFilesNum = (SELECT COUNT(*) FROM `bx_notes_photos`);
  15. 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
  16. ('bx_notes_photos', 'Local', '', 360, 2592000, 3, 'bx_notes_photos', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalFilesSize, 0, @iTotalFilesNum, 0, 0),
  17. ('bx_notes_photos_resized', 'Local', '', 360, 2592000, 3, 'bx_notes_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalFilesSize, 0, @iTotalFilesNum, 0, 0);
  18. INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
  19. ('bx_notes_preview', 'bx_notes_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_notes_photos";}', 'no', '1', '2592000', '0');
  20. INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
  21. ('bx_notes_preview', 'Resize', 'a:4:{s:1:"w";s:3:"100";s:1:"h";s:3:"100";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
  22. -- PAGES
  23. --
  24. -- Dumping data for 'bx_notes_create_note' page
  25. --
  26. INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
  27. ('bx_notes_create_note', '_bx_notes_page_title_sys_create_note', '_bx_notes_page_title_create_note', 'bx_notes', 5, 2147483647, 1, 'create-note', 'page.php?i=create-note', '', '', '', 0, 1, 0, '', '');
  28. INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
  29. ('bx_notes_create_note', 1, 'bx_notes', '_bx_notes_page_block_title_create_note', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:13:"entity_create";}', 0, 1, 1);
  30. --
  31. -- Dumping data for 'bx_notes_edit_note' page
  32. --
  33. INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
  34. ('bx_notes_edit_note', '_bx_notes_page_title_sys_edit_note', '_bx_notes_page_title_edit_note', 'bx_notes', 5, 2147483647, 1, 'edit-note', '', '', '', '', 0, 1, 0, 'BxNotesPageNote', 'modules/boonex/notes/classes/BxNotesPageNote.php');
  35. INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
  36. ('bx_notes_edit_note', 1, 'bx_notes', '_bx_notes_page_block_title_edit_note', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:17:"entity_edit_block";}', 0, 0, 0);
  37. --
  38. -- Dumping data for 'bx_notes_delete_note' page
  39. --
  40. INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
  41. ('bx_notes_delete_note', '_bx_notes_page_title_sys_delete_note', '_bx_notes_page_title_delete_note', 'bx_notes', 5, 2147483647, 1, 'delete-note', '', '', '', '', 0, 1, 0, 'BxNotesPageNote', 'modules/boonex/notes/classes/BxNotesPageNote.php');
  42. INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
  43. ('bx_notes_delete_note', 1, 'bx_notes', '_bx_notes_page_block_title_delete_note', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:19:"entity_delete_block";}', 0, 0, 0);
  44. --
  45. -- Dumping data for 'bx_notes_view_note' page
  46. --
  47. INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
  48. ('bx_notes_view_note', '_bx_notes_page_title_sys_view_note', '_bx_notes_page_title_view_note', 'bx_notes', 6, 2147483647, 1, 'view-note', '', '', '', '', 0, 1, 0, 'BxNotesPageNote', 'modules/boonex/notes/classes/BxNotesPageNote.php');
  49. INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
  50. ('bx_notes_view_note', 1, 'bx_notes', '_bx_notes_page_block_title_note_text', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:17:"entity_text_block";}', 0, 0, 0),
  51. ('bx_notes_view_note', 2, 'bx_notes', '_bx_notes_page_block_title_note_social_sharing', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:21:"entity_social_sharing";}', 0, 0, 1),
  52. ('bx_notes_view_note', 2, 'bx_notes', '_bx_notes_page_block_title_note_author', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:13:"entity_author";}', 0, 0, 0),
  53. ('bx_notes_view_note', 3, 'bx_notes', '_bx_notes_page_block_title_note_comments', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:15:"entity_comments";}', 0, 0, 0);
  54. --
  55. -- Dumping data for 'bx_notes_view_note_comments' page
  56. --
  57. INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
  58. ('bx_notes_view_note_comments', '_bx_notes_page_title_sys_view_note_comments', '_bx_notes_page_title_view_note_comments', 'bx_notes', 5, 2147483647, 1, 'view-note-comments', '', '', '', '', 0, 1, 0, 'BxNotesPageNote', 'modules/boonex/notes/classes/BxNotesPageNote.php');
  59. INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
  60. ('bx_notes_view_note_comments', 1, 'bx_notes', '_bx_notes_page_block_title_note_comments', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:15:\"entity_comments\";}', 0, 0, 1);
  61. --
  62. -- Dumping data for 'bx_notes_home' page
  63. --
  64. INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
  65. ('bx_notes_home', '_bx_notes_page_title_sys_notes_home', '_bx_notes_page_title_notes_home', 'bx_notes', 5, 2147483647, 1, 'notes-home', 'page.php?i=notes-home', '', '', '', 0, 1, 0, 'BxNotesPageBrowse', 'modules/boonex/notes/classes/BxNotesPageBrowse.php');
  66. INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
  67. ('bx_notes_home', 1, 'bx_notes', '_bx_notes_page_block_title_recent_notes', 0, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:13:\"browse_recent\";}', 0, 1, 0);
  68. --
  69. -- Dumping data for 'bx_notes_featured' page
  70. --
  71. INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
  72. ('bx_notes_featured', '_bx_notes_page_title_sys_notes_featured', '_bx_notes_page_title_notes_featured', 'bx_notes', 5, 2147483647, 1, 'notes-featured', 'page.php?i=notes-featured', '', '', '', 0, 1, 0, 'BxNotesPageBrowse', 'modules/boonex/notes/classes/BxNotesPageBrowse.php');
  73. INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
  74. ('bx_notes_featured', 1, 'bx_notes', '_bx_notes_page_block_title_featured_notes', 0, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:15:\"browse_featured\";}', 0, 1, 1);
  75. -- MENU
  76. SET @iSiteMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_site' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
  77. INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `order`) VALUES
  78. ('sys_site', 'bx_notes', 'notes-home', '_bx_notes_menu_item_title_system_notes_home', '_bx_notes_menu_item_title_notes_home', 'page.php?i=notes-home', '', '', 'file-text col-red3', '', 2147483647, 1, IFNULL(@iSiteMenuOrder, 0) + 1);
  79. SET @iAddMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_add_content_links' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
  80. INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `order`) VALUES
  81. ('sys_add_content_links', 'bx_notes', 'create-note', '_bx_notes_menu_item_title_system_create_note', '_bx_notes_menu_item_title_create_note', 'page.php?i=create-note', '', '', '', '', 2147483647, 1, IFNULL(@iAddMenuOrder, 0) + 1);
  82. --
  83. -- Dumping data for 'bx_notes_view' menu
  84. --
  85. INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  86. ('bx_notes_view', '_bx_notes_menu_title_view_note', 'bx_notes_view', 'bx_notes', 4, 0, 1, 'BxNotesMenuViewNote', 'modules/boonex/notes/classes/BxNotesMenuViewNote.php');
  87. INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
  88. ('bx_notes_view', 'bx_notes', '_bx_notes_menu_set_title_view_note', 0);
  89. INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `order`) VALUES
  90. ('bx_notes_view', 'bx_notes', 'view-note', '_bx_notes_menu_item_title_system_view_note', '_bx_notes_menu_item_title_view_note', 'page.php?i=view-note&id={content_id}', '', '', 'eye-open', '', 2147483647, 1, 0),
  91. ('bx_notes_view', 'bx_notes', 'edit-note', '_bx_notes_menu_item_title_system_edit_note', '_bx_notes_menu_item_title_edit_note', 'page.php?i=edit-note&id={content_id}', '', '', 'pencil', '', 2147483647, 1, 1),
  92. ('bx_notes_view', 'bx_notes', 'delete-note', '_bx_notes_menu_item_title_system_delete_note', '_bx_notes_menu_item_title_delete_note', 'page.php?i=delete-note&id={content_id}', '', '', 'remove', '', 2147483647, 1, 2);
  93. --
  94. -- Dumping data for 'bx_notes_submenu' menu
  95. --
  96. INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  97. ('bx_notes_submenu', '_bx_notes_menu_title_submenu', 'bx_notes_submenu', 'bx_notes', 8, 0, 1, '', '');
  98. INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
  99. ('bx_notes_submenu', 'bx_notes', '_bx_notes_menu_set_title_submenu', 0);
  100. INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES
  101. ('bx_notes_submenu', 'bx_notes', 'notes-home', '_bx_notes_menu_item_title_system_notes_recent', '_bx_notes_menu_item_title_notes_recent', 'page.php?i=notes-home', '', '', '', '', 2147483647, 1, 1, 1),
  102. ('bx_notes_submenu', 'bx_notes', 'notes-featured', '_bx_notes_menu_item_title_system_notes_featured', '_bx_notes_menu_item_title_notes_featured', 'page.php?i=notes-featured', '', '', '', '', 2147483647, 1, 1, 2);
  103. --
  104. -- Dumping data for 'bx_notes_view_submenu' menu
  105. --
  106. INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  107. ('bx_notes_view_submenu', '_bx_notes_menu_title_view_note_submenu', 'bx_notes_view_submenu', 'bx_notes', 8, 0, 1, 'BxNotesMenuViewNote', 'modules/boonex/notes/classes/BxNotesMenuViewNote.php');
  108. INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
  109. ('bx_notes_view_submenu', 'bx_notes', '_bx_notes_menu_set_title_view_note_submenu', 0);
  110. INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES
  111. ('bx_notes_view_submenu', 'bx_notes', 'view-note', '_bx_notes_menu_item_title_system_view_note', '_bx_notes_menu_item_title_view_note_submenu_note', 'page.php?i=view-note&id={content_id}', '', '', '', '', 2147483647, 1, 1, 1),
  112. ('bx_notes_view_submenu', 'bx_notes', 'view-note-comments', '_bx_notes_menu_item_title_system_view_note_comments', '_bx_notes_menu_item_title_view_note_submenu_comments', 'page.php?i=view-note-comments&id={content_id}', '', '', '', '', 2147483647, 1, 0, 2);
  113. -- ACL
  114. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  115. ('bx_notes', 'create note', NULL, '_bx_notes_acl_action_create_note', '', 1, 1);
  116. SET @iIdActionNoteCreate = LAST_INSERT_ID();
  117. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  118. ('bx_notes', 'delete note', NULL, '_bx_notes_acl_action_delete_note', '', 1, 1);
  119. SET @iIdActionNoteDelete = LAST_INSERT_ID();
  120. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  121. ('bx_notes', 'view note', NULL, '_bx_notes_acl_action_view_note', '', 1, 1);
  122. SET @iIdActionNoteView = LAST_INSERT_ID();
  123. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  124. ('bx_notes', 'set thumb', NULL, '_bx_notes_acl_action_set_thumb', '', 1, 1);
  125. SET @iIdActionSetThumb = LAST_INSERT_ID();
  126. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  127. ('bx_notes', 'edit any note', NULL, '_bx_notes_acl_action_edit_any_note', '', 1, 1);
  128. SET @iIdActionNoteEditAny = LAST_INSERT_ID();
  129. SET @iUnauthenticated = 1;
  130. SET @iStandard = 2;
  131. SET @iUnconfirmed = 3;
  132. SET @iPending = 4;
  133. SET @iSuspended = 5;
  134. SET @iModerator = 6;
  135. SET @iAdministrator = 7;
  136. SET @iPremium = 8;
  137. INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
  138. -- note create
  139. (@iStandard, @iIdActionNoteCreate),
  140. (@iModerator, @iIdActionNoteCreate),
  141. (@iAdministrator, @iIdActionNoteCreate),
  142. (@iPremium, @iIdActionNoteCreate),
  143. -- note delete
  144. (@iStandard, @iIdActionNoteDelete),
  145. (@iModerator, @iIdActionNoteDelete),
  146. (@iAdministrator, @iIdActionNoteDelete),
  147. (@iPremium, @iIdActionNoteDelete),
  148. -- note view
  149. (@iUnauthenticated, @iIdActionNoteView),
  150. (@iStandard, @iIdActionNoteView),
  151. (@iUnconfirmed, @iIdActionNoteView),
  152. (@iPending, @iIdActionNoteView),
  153. (@iModerator, @iIdActionNoteView),
  154. (@iAdministrator, @iIdActionNoteView),
  155. (@iPremium, @iIdActionNoteView),
  156. -- set note thumb
  157. (@iStandard, @iIdActionSetThumb),
  158. (@iModerator, @iIdActionSetThumb),
  159. (@iAdministrator, @iIdActionSetThumb),
  160. (@iPremium, @iIdActionSetThumb),
  161. -- any note edit
  162. (@iModerator, @iIdActionNoteEditAny),
  163. (@iAdministrator, @iIdActionNoteEditAny);