enable.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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, 1, 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, 1, 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_home' 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_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, '', '');
  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_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:19:"browse_recent_notes";}', 0, 0, 0);
  61. -- MENU
  62. SET @iSiteMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_site' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
  63. INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `order`) VALUES
  64. ('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', '', '', '', '', 2147483647, 1, IFNULL(@iSiteMenuOrder, 0) + 1);
  65. SET @iAddMenuOrder = (SELECT `order` FROM `sys_menu_items` WHERE `set_name` = 'sys_add_content_links' AND `active` = 1 ORDER BY `order` DESC LIMIT 1);
  66. INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `order`) VALUES
  67. ('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);
  68. --
  69. -- Dumping data for 'bx_notes_view' menu
  70. --
  71. INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  72. ('bx_notes_view', '_bx_notes_menu_title_view_note', 'bx_notes_view', 'bx_notes', 4, 0, 1, 'BxNotesMenuViewNote', 'modules/boonex/notes/classes/BxNotesMenuViewNote.php');
  73. INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
  74. ('bx_notes_view', 'bx_notes', '_bx_notes_menu_set_title_view_note', 0);
  75. INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `order`) VALUES
  76. ('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),
  77. ('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),
  78. ('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);
  79. -- ACL
  80. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  81. ('bx_notes', 'create note', NULL, '_bx_notes_acl_action_create_note', '', 1, 1);
  82. SET @iIdActionNoteCreate = LAST_INSERT_ID();
  83. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  84. ('bx_notes', 'delete note', NULL, '_bx_notes_acl_action_delete_note', '', 1, 1);
  85. SET @iIdActionNoteDelete = LAST_INSERT_ID();
  86. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  87. ('bx_notes', 'view note', NULL, '_bx_notes_acl_action_view_note', '', 1, 1);
  88. SET @iIdActionNoteView = LAST_INSERT_ID();
  89. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  90. ('bx_notes', 'set thumb', NULL, '_bx_notes_acl_action_set_thumb', '', 1, 1);
  91. SET @iIdActionSetThumb = LAST_INSERT_ID();
  92. INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
  93. ('bx_notes', 'edit any note', NULL, '_bx_notes_acl_action_edit_any_note', '', 1, 1);
  94. SET @iIdActionNoteEditAny = LAST_INSERT_ID();
  95. SET @iUnauthenticated = 1;
  96. SET @iStandard = 2;
  97. SET @iUnconfirmed = 3;
  98. SET @iPending = 4;
  99. SET @iSuspended = 5;
  100. SET @iModerator = 6;
  101. SET @iAdministrator = 7;
  102. SET @iPremium = 8;
  103. INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
  104. -- note create
  105. (@iStandard, @iIdActionNoteCreate),
  106. (@iModerator, @iIdActionNoteCreate),
  107. (@iAdministrator, @iIdActionNoteCreate),
  108. (@iPremium, @iIdActionNoteCreate),
  109. -- note delete
  110. (@iStandard, @iIdActionNoteDelete),
  111. (@iModerator, @iIdActionNoteDelete),
  112. (@iAdministrator, @iIdActionNoteDelete),
  113. (@iPremium, @iIdActionNoteDelete),
  114. -- note view
  115. (@iUnauthenticated, @iIdActionNoteView),
  116. (@iStandard, @iIdActionNoteView),
  117. (@iUnconfirmed, @iIdActionNoteView),
  118. (@iPending, @iIdActionNoteView),
  119. (@iModerator, @iIdActionNoteView),
  120. (@iAdministrator, @iIdActionNoteView),
  121. (@iPremium, @iIdActionNoteView),
  122. -- set note thumb
  123. (@iStandard, @iIdActionSetThumb),
  124. (@iModerator, @iIdActionSetThumb),
  125. (@iAdministrator, @iIdActionSetThumb),
  126. (@iPremium, @iIdActionSetThumb),
  127. -- any note edit
  128. (@iModerator, @iIdActionNoteEditAny),
  129. (@iAdministrator, @iIdActionNoteEditAny);