BxPostsConfig.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Posts Posts
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxPostsConfig extends BxBaseModTextConfig
  12. {
  13. function __construct($aModule)
  14. {
  15. parent::__construct($aModule);
  16. $aMenuItems2Methods = array (
  17. 'approve' => 'checkAllowedApprove',
  18. 'edit-post' => 'checkAllowedEdit',
  19. 'delete-post' => 'checkAllowedDelete',
  20. );
  21. $this->CNF = array_merge($this->CNF, array (
  22. // module icon
  23. 'ICON' => 'file-alt col-red3',
  24. // database tables
  25. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'posts',
  26. 'TABLE_ENTRIES_FULLTEXT' => 'title_text',
  27. // database fields
  28. 'FIELD_ID' => 'id',
  29. 'FIELD_AUTHOR' => 'author',
  30. 'FIELD_ADDED' => 'added',
  31. 'FIELD_CHANGED' => 'changed',
  32. 'FIELD_PUBLISHED' => 'published',
  33. 'FIELD_TITLE' => 'title',
  34. 'FIELD_TEXT' => 'text',
  35. 'FIELD_TEXT_ID' => 'post-text',
  36. 'FIELD_CATEGORY' => 'cat',
  37. 'FIELD_MULTICAT' => 'multicat',
  38. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  39. 'FIELD_CF' => 'cf',
  40. 'FIELD_COVER' => 'covers',
  41. 'FIELD_PHOTO' => 'pictures',
  42. 'FIELD_VIDEO' => 'videos',
  43. 'FIELD_SOUND' => 'sounds',
  44. 'FIELD_FILE' => 'files',
  45. 'FIELD_POLL' => 'polls',
  46. 'FIELD_THUMB' => 'thumb',
  47. 'FIELD_THUMB_POSITION' => 'thumb_data',
  48. 'FIELD_LINK' => 'link',
  49. 'FIELD_ATTACHMENTS' => 'attachments',
  50. 'FIELD_VIEWS' => 'views',
  51. 'FIELD_COMMENTS' => 'comments',
  52. 'FIELD_STATUS' => 'status',
  53. 'FIELD_STATUS_ADMIN' => 'status_admin',
  54. 'FIELD_LOCATION' => 'location',
  55. 'FIELD_LOCATION_PREFIX' => 'location',
  56. 'FIELD_LABELS' => 'labels',
  57. 'FIELD_ANONYMOUS' => 'anonymous',
  58. 'FIELD_ALLOW_COMMENTS' => 'allow_comments',
  59. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  60. 'FIELDS_DELAYED_PROCESSING' => 'videos', // can be array of fields or comma separated string of field names
  61. // page URIs
  62. 'URI_VIEW_ENTRY' => 'view-post',
  63. 'URI_AUTHOR_ENTRIES' => 'posts-author',
  64. 'URI_ENTRIES_BY_CONTEXT' => 'posts-context',
  65. 'URI_ADD_ENTRY' => 'create-post',
  66. 'URI_EDIT_ENTRY' => 'edit-post',
  67. 'URI_MANAGE_COMMON' => 'posts-manage',
  68. 'URI_FAVORITES_LIST' => 'posts-favorites',
  69. 'URL_HOME' => 'page.php?i=posts-home',
  70. 'URL_POPULAR' => 'page.php?i=posts-popular',
  71. 'URL_TOP' => 'page.php?i=posts-top',
  72. 'URL_UPDATED' => 'page.php?i=posts-updated',
  73. 'URL_MANAGE_COMMON' => 'page.php?i=posts-manage',
  74. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=posts-administration',
  75. // some params
  76. 'PARAM_AUTO_APPROVE' => 'bx_posts_enable_auto_approve',
  77. 'PARAM_CHARS_SUMMARY' => 'bx_posts_summary_chars',
  78. 'PARAM_CHARS_SUMMARY_PLAIN' => 'bx_posts_plain_summary_chars',
  79. 'PARAM_NUM_RSS' => 'bx_posts_rss_num',
  80. 'PARAM_SEARCHABLE_FIELDS' => 'bx_posts_searchable_fields',
  81. 'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_posts_per_page_browse_showcase',
  82. 'PARAM_PER_PAGE_FOR_FAVORITES_LISTS' => 'bx_posts_per_page_for_favorites_lists',
  83. 'PARAM_MULTICAT_ENABLED' => true,
  84. 'PARAM_LINKS_ENABLED' => true,
  85. 'PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES' => 'bx_posts_auto_activation_for_categories',
  86. // objects
  87. 'OBJECT_STORAGE' => 'bx_posts_covers',
  88. 'OBJECT_STORAGE_FILES' => 'bx_posts_files',
  89. 'OBJECT_STORAGE_PHOTOS' => 'bx_posts_photos',
  90. 'OBJECT_STORAGE_VIDEOS' => 'bx_posts_videos',
  91. 'OBJECT_STORAGE_SOUNDS' => 'bx_posts_sounds',
  92. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_posts_preview',
  93. 'OBJECT_IMAGES_TRANSCODER_MINIATURE' => 'bx_posts_miniature',
  94. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_posts_gallery',
  95. 'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_posts_cover',
  96. 'OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES' => 'bx_posts_preview_files',
  97. 'OBJECT_IMAGES_TRANSCODER_GALLERY_FILES' => 'bx_posts_gallery_files',
  98. 'OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS' => 'bx_posts_preview_photos',
  99. 'OBJECT_IMAGES_TRANSCODER_MINIATURE_PHOTOS' => 'bx_posts_miniature_photos',
  100. 'OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS' => 'bx_posts_gallery_photos',
  101. 'OBJECT_IMAGES_TRANSCODER_VIEW_PHOTOS' => 'bx_posts_view_photos',
  102. 'OBJECT_SOUNDS_TRANSCODER' => 'bx_posts_sounds_mp3',
  103. 'OBJECT_VIDEOS_TRANSCODERS' => array(
  104. 'poster' => 'bx_posts_videos_poster',
  105. 'poster_preview' => 'bx_posts_videos_poster_preview',
  106. 'mp4' => 'bx_posts_videos_mp4',
  107. 'mp4_hd' => 'bx_posts_videos_mp4_hd'
  108. ),
  109. 'OBJECT_VIDEO_TRANSCODER_HEIGHT' => '480px',
  110. 'OBJECT_REPORTS' => 'bx_posts',
  111. 'OBJECT_VIEWS' => 'bx_posts',
  112. 'OBJECT_VOTES' => 'bx_posts',
  113. 'OBJECT_REACTIONS' => 'bx_posts_reactions',
  114. 'OBJECT_SCORES' => 'bx_posts',
  115. 'OBJECT_FAVORITES' => 'bx_posts',
  116. 'OBJECT_FEATURED' => 'bx_posts',
  117. 'OBJECT_METATAGS' => 'bx_posts',
  118. 'OBJECT_COMMENTS' => 'bx_posts',
  119. 'OBJECT_NOTES' => 'bx_posts_notes',
  120. 'OBJECT_CATEGORY' => 'bx_posts_cats',
  121. 'OBJECT_PRIVACY_VIEW' => 'bx_posts_allow_view_to',
  122. 'OBJECT_PRIVACY_LIST_VIEW' => 'bx_posts_allow_view_favorite_list',
  123. 'OBJECT_FORM_ENTRY' => 'bx_posts',
  124. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_posts_entry_view',
  125. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_posts_entry_add',
  126. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_posts_entry_edit',
  127. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_posts_entry_delete',
  128. 'OBJECT_FORM_POLL' => 'bx_posts_poll',
  129. 'OBJECT_FORM_POLL_DISPLAY_ADD' => 'bx_posts_poll_add',
  130. 'OBJECT_MENU_ENTRY_ATTACHMENTS' => 'bx_posts_entry_attachments', // attachments menu in create/edit forms
  131. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_posts_view', // actions menu on view entry page
  132. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_posts_view_actions', // all actions menu on view entry page
  133. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_posts_my', // actions menu on my entries page
  134. 'OBJECT_MENU_SUBMENU' => 'bx_posts_submenu', // main module submenu
  135. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_posts_view_submenu', // view entry submenu
  136. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'posts-home', // first item in view entry submenu from main module submenu
  137. 'OBJECT_MENU_SNIPPET_META' => 'bx_posts_snippet_meta', // menu for snippet meta info
  138. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_posts_menu_manage_tools', //manage menu in content administration tools
  139. 'OBJECT_GRID_ADMINISTRATION' => 'bx_posts_administration',
  140. 'OBJECT_GRID_COMMON' => 'bx_posts_common',
  141. 'OBJECT_GRID_CATEGORIES' => 'bx_posts_categories',
  142. 'OBJECT_UPLOADERS' => array('bx_posts_html5'),
  143. 'OBJECT_CONTENT_INFO' => 'bx_posts',
  144. 'OBJECT_CMTS_CONTENT_INFO' => 'bx_posts_cmts',
  145. 'BADGES_AVALIABLE' => true,
  146. // menu items which visibility depends on custom visibility checking
  147. 'MENU_ITEM_TO_METHOD' => array (
  148. 'bx_posts_my' => array (
  149. 'create-post' => 'checkAllowedAdd',
  150. ),
  151. 'bx_posts_view' => $aMenuItems2Methods,
  152. ),
  153. // informer messages
  154. 'INFORMERS' => array (
  155. 'approving' => array (
  156. 'name' => 'bx-posts-approving',
  157. 'map' => array (
  158. 'pending' => array('msg' => '_bx_posts_txt_msg_status_pending', 'type' => BX_INFORMER_ALERT),
  159. 'hidden' => array('msg' => '_bx_posts_txt_msg_status_hidden', 'type' => BX_INFORMER_ERROR),
  160. ),
  161. ),
  162. 'processing' => array (
  163. 'name' => 'bx-posts-processing',
  164. 'map' => array (
  165. 'awaiting' => array('msg' => '_bx_posts_txt_processing_awaiting', 'type' => BX_INFORMER_ALERT),
  166. 'failed' => array('msg' => '_bx_posts_txt_processing_failed', 'type' => BX_INFORMER_ERROR)
  167. ),
  168. ),
  169. 'scheduled' => array (
  170. 'name' => 'bx-posts-scheduled',
  171. 'map' => array (
  172. 'awaiting' => array('msg' => '_bx_posts_txt_scheduled_awaiting', 'type' => BX_INFORMER_ALERT),
  173. ),
  174. ),
  175. ),
  176. // some language keys
  177. 'T' => array (
  178. 'txt_sample_single' => '_bx_posts_txt_sample_single',
  179. 'txt_sample_single_with_article' => '_bx_posts_txt_sample_single_with_article',
  180. 'txt_sample_comment_single' => '_bx_posts_txt_sample_comment_single',
  181. 'txt_sample_vote_single' => '_bx_posts_txt_sample_vote_single',
  182. 'txt_sample_reaction_single' => '_bx_posts_txt_sample_reaction_single',
  183. 'txt_sample_score_up_single' => '_bx_posts_txt_sample_score_up_single',
  184. 'txt_sample_score_down_single' => '_bx_posts_txt_sample_score_down_single',
  185. 'form_field_author' => '_bx_posts_form_entry_input_author',
  186. 'grid_action_err_delete' => '_bx_posts_grid_action_err_delete',
  187. 'grid_txt_account_manager' => '_bx_posts_grid_txt_account_manager',
  188. 'filter_item_active' => '_bx_posts_grid_filter_item_title_adm_active',
  189. 'filter_item_hidden' => '_bx_posts_grid_filter_item_title_adm_hidden',
  190. 'filter_item_pending' => '_bx_posts_grid_filter_item_title_adm_pending',
  191. 'filter_item_select_one_filter1' => '_bx_posts_grid_filter_item_title_adm_select_one_filter1',
  192. 'filter_item_select_one_filter2' => '_bx_posts_grid_filter_item_title_adm_select_one_filter2',
  193. 'menu_item_manage_my' => '_bx_posts_menu_item_title_manage_my',
  194. 'menu_item_manage_all' => '_bx_posts_menu_item_title_manage_all',
  195. 'txt_all_entries_by' => '_bx_posts_txt_all_entries_by',
  196. 'txt_all_entries_in' => '_bx_posts_txt_all_entries_in',
  197. 'txt_all_entries_by_author' => '_bx_posts_page_title_browse_by_author',
  198. 'txt_all_entries_by_context' => '_bx_posts_page_title_browse_by_context',
  199. 'txt_err_cannot_perform_action' => '_bx_posts_txt_err_cannot_perform_action',
  200. 'txt_poll_form_answers_add' => '_bx_posts_form_poll_input_answers_add',
  201. 'txt_poll_menu_view_answers' => '_bx_posts_txt_poll_view_answers',
  202. 'txt_poll_menu_view_results' => '_bx_posts_txt_poll_view_results',
  203. 'txt_poll_menu_view_' => '_bx_posts_txt_poll_view_',
  204. 'txt_poll_answer_vote_do_by' => '_bx_posts_txt_poll_answer_vote_do_by',
  205. 'txt_poll_answer_vote_counter' => '_bx_posts_txt_poll_answer_vote_counter',
  206. 'txt_poll_answer_vote_percent' => '_bx_posts_txt_poll_answer_vote_percent'
  207. ),
  208. ));
  209. $this->_aPrefixes = array(
  210. 'style' => 'bx-posts',
  211. );
  212. $this->_aJsClasses = array_merge($this->_aJsClasses, array(
  213. 'manage_tools' => 'BxPostsManageTools',
  214. 'categories' => 'BxDolCategories'
  215. ));
  216. $this->_aJsObjects = array_merge($this->_aJsObjects, array(
  217. 'manage_tools' => 'oBxPostsManageTools',
  218. 'categories' => 'oBxDolCategories'
  219. ));
  220. $this->_aGridObjects = array(
  221. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  222. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  223. );
  224. $this->_bAttachmentsInTimeline = true;
  225. }
  226. }
  227. /** @} */