BxStoriesConfig.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 Stories Stories
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxStoriesConfig extends BxBaseModTextConfig
  12. {
  13. function __construct($aModule)
  14. {
  15. parent::__construct($aModule);
  16. $aMenuItems2Methods = array (
  17. 'approve' => 'checkAllowedApprove',
  18. 'add-media-to-story' => 'checkAllowedEdit',
  19. 'edit-story' => 'checkAllowedEdit',
  20. 'edit-image' => 'checkAllowedEdit',
  21. 'move-image' => 'checkAllowedEdit',
  22. 'delete-story' => 'checkAllowedDelete',
  23. 'delete-image' => 'checkAllowedDelete',
  24. );
  25. $this->CNF = array (
  26. // module icon
  27. 'ICON' => 'far image',
  28. // database tables
  29. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'entries',
  30. 'TABLE_ENTRIES_FULLTEXT' => 'title_text',
  31. 'TABLE_ENTRIES_MEDIA' => $aModule['db_prefix'] . 'entries_media',
  32. 'TABLE_FILES' => $aModule['db_prefix'] . 'files',
  33. // database fields
  34. 'FIELD_ID' => 'id',
  35. 'FIELD_AUTHOR' => 'author',
  36. 'FIELD_ADDED' => 'added',
  37. 'FIELD_CHANGED' => 'changed',
  38. 'FIELD_EXPIRED' => 'expired',
  39. 'FIELD_TITLE' => 'title',
  40. 'FIELD_TEXT' => 'text',
  41. 'FIELD_TEXT_ID' => 'story-desc',
  42. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  43. 'FIELD_CF' => 'cf',
  44. 'FIELD_PHOTO' => 'pictures',
  45. 'FIELD_THUMB' => 'thumb',
  46. 'FIELD_VIEWS' => 'views',
  47. 'FIELD_COMMENTS' => 'comments',
  48. 'FIELD_STATUS' => 'status',
  49. 'FIELD_STATUS_ADMIN' => 'status_admin',
  50. 'FIELD_LABELS' => 'labels',
  51. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  52. 'FIELDS_DELAYED_PROCESSING' => 'pictures', // can be array of fields or comma separated string of field names
  53. 'FIELD_MEDIA_CONTENT_ID' => 'content_id',
  54. // page URIs
  55. 'URI_VIEW_ENTRY' => 'view-story',
  56. 'URI_AUTHOR_ENTRIES' => 'stories-author',
  57. 'URI_ENTRIES_BY_CONTEXT' => 'stories-context',
  58. 'URI_ADD_ENTRY' => 'create-story',
  59. 'URI_EDIT_ENTRY' => 'edit-story',
  60. 'URI_MANAGE_COMMON' => 'stories-manage',
  61. 'URL_HOME' => 'page.php?i=stories-home',
  62. 'URL_POPULAR' => 'page.php?i=stories-popular',
  63. 'URL_TOP' => 'page.php?i=stories-top',
  64. 'URL_UPDATED' => 'page.php?i=stories-home',
  65. 'URL_MANAGE_COMMON' => 'page.php?i=stories-manage',
  66. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=stories-administration',
  67. // some params
  68. 'PARAM_AUTO_APPROVE' => 'bx_stories_enable_auto_approve',
  69. 'PARAM_CHARS_SUMMARY' => 'bx_stories_summary_chars',
  70. 'PARAM_CHARS_SUMMARY_PLAIN' => 'bx_stories_plain_summary_chars',
  71. 'PARAM_NUM_RSS' => 'bx_stories_rss_num',
  72. 'PARAM_SEARCHABLE_FIELDS' => 'bx_stories_searchable_fields',
  73. 'PARAM_CARD_MEDIA_NUM' => 'bx_stories_card_media_num',
  74. 'PARAM_EXPIRATION_PERIOD' => 'bx_stories_expiration_period',
  75. 'PARAM_DURATION' => 'bx_stories_duration',
  76. 'PARAM_ORDER_BY_GHOSTS' => true,
  77. // objects
  78. 'OBJECT_STORAGE' => 'bx_stories_files',
  79. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_stories_proxy_preview',
  80. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => '',
  81. 'OBJECT_IMAGES_TRANSCODER_BIG' => 'bx_stories_big',
  82. 'OBJECT_VIDEOS_TRANSCODERS' => array(
  83. 'poster' => 'bx_stories_video_poster_big',
  84. 'poster_preview' => 'bx_stories_video_poster_preview',
  85. 'mp4' => 'bx_stories_video_mp4',
  86. 'mp4_hd' => 'bx_stories_video_mp4_hd'
  87. ),
  88. 'OBJECT_VIDEO_TRANSCODER_HEIGHT' => '480px',
  89. 'OBJECT_TRANSCODER_BROWSE' => 'bx_stories_proxy_browse',
  90. 'OBJECT_TRANSCODER_COVER' => 'bx_stories_proxy_cover',
  91. 'OBJECT_REPORTS' => 'bx_stories',
  92. 'OBJECT_REPORTS_MEDIA' => 'bx_stories_media',
  93. 'OBJECT_VIEWS' => 'bx_stories',
  94. 'OBJECT_VIEWS_MEDIA' => 'bx_stories_media',
  95. 'OBJECT_VOTES' => 'bx_stories',
  96. 'OBJECT_VOTES_MEDIA' => 'bx_stories_media',
  97. 'OBJECT_REACTIONS' => 'bx_stories_reactions',
  98. 'OBJECT_SCORES' => 'bx_stories',
  99. 'OBJECT_SCORES_MEDIA' => 'bx_stories_media',
  100. 'OBJECT_FAVORITES' => 'bx_stories',
  101. 'OBJECT_FAVORITES_MEDIA' => 'bx_stories_media',
  102. 'OBJECT_FEATURED' => 'bx_stories',
  103. 'OBJECT_FEATURED_MEDIA' => 'bx_stories_media',
  104. 'OBJECT_METATAGS' => 'bx_stories',
  105. 'OBJECT_COMMENTS' => 'bx_stories',
  106. 'OBJECT_NOTES' => 'bx_stories_notes',
  107. 'OBJECT_COMMENTS_MEDIA' => 'bx_stories_media',
  108. 'OBJECT_PRIVACY_VIEW' => 'bx_stories_allow_view_to',
  109. 'OBJECT_PRIVACY_LIST_VIEW' => 'bx_stories_allow_view_favorite_list',
  110. 'OBJECT_FORM_ENTRY' => 'bx_stories',
  111. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_stories_entry_view',
  112. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_stories_entry_add',
  113. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_stories_entry_edit',
  114. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_stories_entry_delete',
  115. 'OBJECT_FORM_MEDIA' => 'bx_stories_media',
  116. 'OBJECT_FORM_MEDIA_DISPLAY_EDIT' => 'bx_stories_media_edit',
  117. 'OBJECT_FORM_MEDIA_DISPLAY_MOVE' => 'bx_stories_media_move',
  118. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_stories_view', // actions menu on view entry page
  119. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_stories_view_actions', // all actions menu on view entry page
  120. 'OBJECT_MENU_ACTIONS_VIEW_MEDIA' => 'bx_stories_view_actions_media', // actions menu on view media page
  121. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_stories_my', // actions menu on my entries page
  122. 'OBJECT_MENU_SUBMENU' => 'bx_stories_submenu', // main module submenu
  123. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_stories_view_submenu', // view entry submenu
  124. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'stories-home', // first item in view entry submenu from main module submenu
  125. 'OBJECT_MENU_SNIPPET_META' => 'bx_stories_snippet_meta', // menu for snippet meta info
  126. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_stories_menu_manage_tools', //manage menu in content administration tools
  127. 'OBJECT_GRID_ADMINISTRATION' => 'bx_stories_administration',
  128. 'OBJECT_GRID_COMMON' => 'bx_stories_common',
  129. 'OBJECT_UPLOADERS' => array('bx_stories_html5', 'bx_stories_crop'),
  130. 'FUNCTION_FOR_GET_ITEM_INFO' => 'getMediaInfoById',
  131. // menu items which visibility depends on custom visibility checking
  132. 'MENU_ITEM_TO_METHOD' => array (
  133. 'bx_stories_my' => array (
  134. 'create-story' => 'checkAllowedAdd',
  135. ),
  136. 'bx_stories_view' => $aMenuItems2Methods,
  137. 'bx_stories_view_media' => $aMenuItems2Methods,
  138. ),
  139. // informer messages
  140. 'INFORMERS' => array (
  141. 'approving' => array (
  142. 'name' => 'bx-stories-approving',
  143. 'map' => array (
  144. 'pending' => array('msg' => '_bx_stories_txt_msg_status_pending', 'type' => BX_INFORMER_ALERT),
  145. 'hidden' => array('msg' => '_bx_stories_txt_msg_status_hidden', 'type' => BX_INFORMER_ERROR),
  146. ),
  147. ),
  148. 'processing' => array (
  149. 'name' => 'bx_stories-processing',
  150. 'map' => array (
  151. 'awaiting' => array('msg' => '_bx_stories_txt_processing_awaiting', 'type' => BX_INFORMER_ALERT),
  152. 'failed' => array('msg' => '_bx_stories_txt_processing_failed', 'type' => BX_INFORMER_ERROR)
  153. ),
  154. ),
  155. ),
  156. // some language keys
  157. 'T' => array (
  158. 'txt_sample_single' => '_bx_stories_txt_sample_single',
  159. 'txt_sample_single_with_article' => '_bx_stories_txt_sample_single_with_article',
  160. 'txt_sample_comment_single' => '_bx_stories_txt_sample_comment_single',
  161. 'txt_sample_vote_single' => '_bx_stories_txt_sample_vote_single',
  162. 'txt_sample_reaction_single' => '_bx_stories_txt_sample_reaction_single',
  163. 'txt_sample_score_up_single' => '_bx_stories_txt_sample_score_up_single',
  164. 'txt_sample_score_down_single' => '_bx_stories_txt_sample_score_down_single',
  165. 'txt_sample_action_changed' => '_bx_stories_txt_sample_action_changed',
  166. 'txt_media_single' => '_bx_stories_txt_media_single',
  167. 'txt_media_comment_single' => '_bx_stories_txt_media_comment_single',
  168. 'txt_media_vote_single' => '_bx_stories_txt_media_vote_single',
  169. 'txt_media_score_up_single' => '_bx_stories_txt_media_score_up_single',
  170. 'txt_media_score_down_single' => '_bx_stories_txt_media_score_down_single',
  171. 'form_field_author' => '_bx_stories_form_entry_input_author',
  172. 'grid_action_err_delete' => '_bx_stories_grid_action_err_delete',
  173. 'grid_txt_account_manager' => '_bx_stories_grid_txt_account_manager',
  174. 'filter_item_active' => '_bx_stories_grid_filter_item_title_adm_active',
  175. 'filter_item_hidden' => '_bx_stories_grid_filter_item_title_adm_hidden',
  176. 'filter_item_pending' => '_bx_stories_grid_filter_item_title_adm_pending',
  177. 'filter_item_select_one_filter1' => '_bx_stories_grid_filter_item_title_adm_select_one_filter1',
  178. 'filter_item_select_one_filter2' => '_bx_stories_grid_filter_item_title_adm_select_one_filter2',
  179. 'menu_item_manage_my' => '_bx_stories_menu_item_title_manage_my',
  180. 'menu_item_manage_all' => '_bx_stories_menu_item_title_manage_all',
  181. 'txt_all_entries_by' => '_bx_stories_txt_all_entries_by',
  182. 'txt_all_entries_in' => '_bx_stories_txt_all_entries_in',
  183. 'txt_all_entries_by_author' => '_bx_stories_page_title_browse_by_author',
  184. 'txt_all_entries_by_context' => '_bx_stories_page_title_browse_by_context',
  185. ),
  186. );
  187. $this->_aJsClasses = [
  188. 'main' => 'BxStoriesMain',
  189. 'manage_tools' => 'BxStoriesManageTools'
  190. ];
  191. $this->_aJsObjects = [
  192. 'main' => 'oBxStoriesMain',
  193. 'manage_tools' => 'oBxStoriesManageTools'
  194. ];
  195. $this->_aGridObjects = [
  196. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  197. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  198. ];
  199. $sPrefix = str_replace('_', '-', $this->_sName);
  200. $this->_aHtmlIds = [
  201. 'play_popup' => $sPrefix . '-play-popup',
  202. ];
  203. }
  204. public function getDuration()
  205. {
  206. return (int)getParam($this->CNF['PARAM_DURATION']);
  207. }
  208. }
  209. /** @} */