BxResourcesConfig.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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 Resources Resources
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolInformer');
  12. class BxResourcesConfig extends BxBaseModTextConfig
  13. {
  14. protected $_aProperties;
  15. function __construct($aModule)
  16. {
  17. parent::__construct($aModule);
  18. $aMenuItems2Methods = array (
  19. 'approve' => 'checkAllowedApprove',
  20. 'edit-resource' => 'checkAllowedEdit',
  21. 'edit-resource-state' => 'checkAllowedManage',
  22. 'delete-resource' => 'checkAllowedDelete',
  23. );
  24. $this->CNF = array_merge($this->CNF, array (
  25. // module icon
  26. 'ICON' => 'warehouse',
  27. // database tables
  28. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'entries',
  29. 'TABLE_LISTS' => $aModule['db_prefix'] . 'lists',
  30. 'TABLE_POLLS' => '',
  31. 'TABLE_ENTRIES_FULLTEXT' => 'title_text',
  32. // database fields
  33. 'FIELD_LIST_ID' => 'id',
  34. 'FIELD_LIST_TITLE' => 'title',
  35. 'FIELD_ID' => 'id',
  36. 'FIELD_AUTHOR' => 'author',
  37. 'FIELD_ADDED' => 'added',
  38. 'FIELD_CHANGED' => 'changed',
  39. 'FIELD_PUBLISHED' => 'published',
  40. 'FIELD_LINK' => 'link',
  41. 'FIELD_TITLE' => 'title',
  42. 'FIELD_TEXT' => 'text',
  43. 'FIELD_TEXT_ID' => 'post-text',
  44. 'FIELD_CATEGORY' => 'cat',
  45. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  46. 'FIELD_CF' => '',
  47. 'FIELD_COVER' => 'covers',
  48. 'FIELD_PHOTO' => '',
  49. 'FIELD_VIDEO' => '',
  50. 'FIELD_FILE' => '',
  51. 'FIELD_THUMB' => 'thumb',
  52. 'FIELD_ATTACHMENTS' => '',
  53. 'FIELD_VIEWS' => 'views',
  54. 'FIELD_COMMENTS' => 'comments',
  55. 'FIELD_STATUS' => 'status',
  56. 'FIELD_STATUS_ADMIN' => 'status_admin',
  57. 'FIELD_LABELS' => 'labels',
  58. 'FIELD_LIST' => 'list',
  59. 'FIELD_ANONYMOUS' => 'anonymous',
  60. 'FIELD_ALLOW_COMMENTS' => 'allow_comments',
  61. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  62. 'FIELDS_DELAYED_PROCESSING' => 'videos', // can be array of fields or comma separated string of field names
  63. // some params
  64. 'PARAM_MULTICAT_ENABLED' => false,
  65. 'PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES' => 'bx_resources_auto_activation_for_categories',
  66. 'PARAM_POLL_ENABLED' => false,
  67. // page URIs
  68. 'URI_VIEW_ENTRY' => 'view-resource',
  69. 'URI_AUTHOR_ENTRIES' => 'resources-author',
  70. 'URI_ENTRIES_BY_CONTEXT' => 'resources-context',
  71. 'URI_ADD_ENTRY' => 'create-resource',
  72. 'URI_EDIT_ENTRY' => 'edit-resource',
  73. 'URI_MANAGE_COMMON' => 'resources-manage',
  74. 'URL_HOME' => '',
  75. 'URL_POPULAR' => '',
  76. 'URL_TOP' => '',
  77. 'URL_UPDATED' => '',
  78. 'URL_MANAGE_COMMON' => 'page.php?i=resources-manage',
  79. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=resources-administration',
  80. // some params
  81. 'PARAM_AUTO_APPROVE' => 'bx_resources_enable_auto_approve',
  82. 'PARAM_CHARS_SUMMARY' => 'bx_resources_summary_chars',
  83. 'PARAM_CHARS_SUMMARY_PLAIN' => 'bx_resources_plain_summary_chars',
  84. 'PARAM_NUM_RSS' => 'bx_resources_rss_num',
  85. 'PARAM_SEARCHABLE_FIELDS' => 'bx_resources_searchable_fields',
  86. 'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_resources_per_page_browse_showcase',
  87. // objects
  88. 'OBJECT_STORAGE' => 'bx_resources_covers',
  89. 'OBJECT_STORAGE_FILES' => '',
  90. 'OBJECT_STORAGE_PHOTOS' => '',
  91. 'OBJECT_STORAGE_VIDEOS' => '',
  92. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_resources_preview',
  93. 'OBJECT_IMAGES_TRANSCODER_MINIATURE' => 'bx_resources_miniature',
  94. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_resources_gallery',
  95. 'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_resources_cover',
  96. 'OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES' => '',
  97. 'OBJECT_IMAGES_TRANSCODER_GALLERY_FILES' => '',
  98. 'OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS' => '',
  99. 'OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS' => '',
  100. 'OBJECT_VIDEOS_TRANSCODERS' => [],
  101. 'OBJECT_VIDEO_TRANSCODER_HEIGHT' => '480px',
  102. 'OBJECT_REPORTS' => 'bx_resources',
  103. 'OBJECT_VIEWS' => 'bx_resources',
  104. 'OBJECT_VOTES' => 'bx_resources',
  105. 'OBJECT_REACTIONS' => 'bx_resources_reactions',
  106. 'OBJECT_SCORES' => 'bx_resources',
  107. 'OBJECT_FAVORITES' => '',
  108. 'OBJECT_FEATURED' => '',
  109. 'OBJECT_COMMENTS' => 'bx_resources',
  110. 'OBJECT_NOTES' => '',
  111. 'OBJECT_CATEGORY' => 'bx_resources_cats',
  112. 'OBJECT_PRIVACY_VIEW' => 'bx_resources_allow_view_to',
  113. 'OBJECT_FORM_ENTRY' => 'bx_resources',
  114. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_resources_entry_view',
  115. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_resources_entry_add',
  116. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_resources_entry_edit',
  117. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_resources_entry_delete',
  118. 'OBJECT_FORM_LIST_ENTRY' => 'bx_resources_list',
  119. 'OBJECT_FORM_LIST_ENTRY_DISPLAY_ADD' => 'bx_resources_list_entry_add',
  120. 'OBJECT_FORM_LIST_ENTRY_DISPLAY_EDIT' => 'bx_resources_list_entry_edit',
  121. 'OBJECT_MENU_ENTRY_ATTACHMENTS' => '', // attachments menu in create/edit forms
  122. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_resources_view', // actions menu on view entry page
  123. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_resources_view_actions', // all actions menu on view entry page
  124. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_resources_my', // actions menu on my entries page
  125. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_resources_view_submenu', // view entry submenu
  126. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'resources-home', // first item in view entry submenu from main module submenu
  127. 'OBJECT_MENU_SNIPPET_META' => '', // menu for snippet meta info
  128. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_resources_menu_manage_tools', //manage menu in content administration tools
  129. 'OBJECT_GRID_ADMINISTRATION' => 'bx_resources_administration',
  130. 'OBJECT_GRID_COMMON' => 'bx_resources_common',
  131. 'OBJECT_UPLOADERS' => array('bx_resources_html5'),
  132. 'OBJECT_CONTENT_INFO' => 'bx_resources',
  133. 'OBJECT_CMTS_CONTENT_INFO' => 'bx_resources_cmts',
  134. 'BADGES_AVALIABLE' => false,
  135. // menu items which visibility depends on custom visibility checking
  136. 'MENU_ITEM_TO_METHOD' => array (
  137. 'bx_resources_view' => $aMenuItems2Methods,
  138. ),
  139. // informer messages
  140. 'INFORMERS' => array (
  141. 'approving' => array (
  142. 'name' => 'bx-resources-approving',
  143. 'map' => array (
  144. 'pending' => array('msg' => '_bx_resources_txt_msg_status_pending', 'type' => BX_INFORMER_ALERT),
  145. 'hidden' => array('msg' => '_bx_resources_txt_msg_status_hidden', 'type' => BX_INFORMER_ERROR),
  146. ),
  147. ),
  148. 'processing' => array (
  149. 'name' => 'bx-resources-processing',
  150. 'map' => array (
  151. 'awaiting' => array('msg' => '_bx_resources_txt_processing_awaiting', 'type' => BX_INFORMER_ALERT),
  152. 'failed' => array('msg' => '_bx_resources_txt_processing_failed', 'type' => BX_INFORMER_ERROR)
  153. ),
  154. ),
  155. 'scheduled' => array (
  156. 'name' => 'bx-resources-scheduled',
  157. 'map' => array (
  158. 'awaiting' => array('msg' => '_bx_resources_txt_scheduled_awaiting', 'type' => BX_INFORMER_ALERT),
  159. ),
  160. ),
  161. ),
  162. // some language keys
  163. 'T' => array (
  164. 'txt_sample_single' => '_bx_resources_txt_sample_single',
  165. 'txt_sample_single_with_article' => '_bx_resources_txt_sample_single_with_article',
  166. 'txt_sample_comment_single' => '_bx_resources_txt_sample_comment_single',
  167. 'txt_sample_vote_single' => '_bx_resources_txt_sample_vote_single',
  168. 'txt_sample_reaction_single' => '_bx_resources_txt_sample_reaction_single',
  169. 'txt_sample_score_up_single' => '_bx_resources_txt_sample_score_up_single',
  170. 'txt_sample_score_down_single' => '_bx_resources_txt_sample_score_down_single',
  171. 'form_field_author' => '_bx_resources_form_entry_input_author',
  172. 'form_field_covers_uploader_simple' => '_bx_resources_form_entry_input_covers_uploader_simple_title',
  173. 'form_field_covers_uploader_html5' => '_bx_resources_form_entry_input_covers_uploader_html5_title',
  174. 'grid_action_err_delete' => '_bx_resources_grid_action_err_delete',
  175. 'grid_txt_account_manager' => '_bx_resources_grid_txt_account_manager',
  176. 'filter_item_active' => '_bx_resources_grid_filter_item_title_adm_active',
  177. 'filter_item_hidden' => '_bx_resources_grid_filter_item_title_adm_hidden',
  178. 'filter_item_pending' => '_bx_resources_grid_filter_item_title_adm_pending',
  179. 'filter_item_select_one_filter1' => '_bx_resources_grid_filter_item_title_adm_select_one_filter1',
  180. 'filter_item_select_one_filter2' => '_bx_resources_grid_filter_item_title_adm_select_one_filter2',
  181. 'filter_item_select_one_filter3' => '_bx_resources_grid_filter_item_title_adm_select_one_filter3',
  182. 'menu_item_manage_my' => '_bx_resources_menu_item_title_manage_my',
  183. 'menu_item_manage_all' => '_bx_resources_menu_item_title_manage_all',
  184. 'txt_all_entries_by' => '_bx_resources_txt_all_entries_by',
  185. 'txt_all_entries_in' => '_bx_resources_txt_all_entries_in',
  186. 'txt_all_entries_by_author' => '_bx_resources_page_title_browse_by_author',
  187. 'txt_all_entries_by_context' => '_bx_resources_page_title_browse_by_context',
  188. 'txt_err_cannot_perform_action' => '_bx_resources_txt_err_cannot_perform_action',
  189. ),
  190. ));
  191. $this->_aJsClasses = array_merge($this->_aJsClasses, [
  192. 'main' => 'BxResourcesMain',
  193. 'manage_tools' => 'BxResourcesManageTools',
  194. ]);
  195. $this->_aJsObjects = array_merge($this->_aJsObjects, [
  196. 'main' => 'oBxResourcesMain',
  197. 'manage_tools' => 'oBxResourcesManageTools',
  198. ]);
  199. $this->_aGridObjects = [
  200. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  201. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  202. ];
  203. $sPrefix = str_replace('_', '-', $this->_sName);
  204. $this->_aHtmlIds = array_merge($this->_aHtmlIds, [
  205. 'lists' => $sPrefix . '-lists',
  206. 'list' => $sPrefix . '-list-',
  207. 'entry_popup_add' => $sPrefix . '-add-entry-popup',
  208. 'entry_popup_edit' => $sPrefix . '-add-entry-popup',
  209. ]);
  210. $this->_bAttachmentsInTimeline = false;
  211. }
  212. }
  213. /** @} */