1
0

BxFilesConfig.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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 Files Files
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxFilesConfig extends BxBaseModTextConfig
  12. {
  13. function __construct($aModule)
  14. {
  15. parent::__construct($aModule);
  16. $aMenuItems2Methods = array (
  17. 'approve' => 'checkAllowedApprove',
  18. 'download-file' => 'checkAllowedView',
  19. 'edit-file' => 'checkAllowedEdit',
  20. 'delete-file' => 'checkAllowedDelete',
  21. );
  22. $this->CNF = array (
  23. // module icon
  24. 'ICON' => 'far file',
  25. // database tables
  26. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'main',
  27. 'TABLE_ENTRIES_FULLTEXT' => 'search_fields',
  28. 'TABLE_FILES' => $aModule['db_prefix'] . 'files',
  29. 'TABLE_BOOKMARKS' => $aModule['db_prefix'] . 'bookmarks',
  30. 'TABLE_FOLDERS' => $aModule['db_prefix'] . 'folders',
  31. // database fields
  32. 'FIELD_ID' => 'id',
  33. 'FIELD_AUTHOR' => 'author',
  34. 'FIELD_ADDED' => 'added',
  35. 'FIELD_CHANGED' => 'changed',
  36. 'FIELD_FILE_ID' => 'file_id',
  37. 'FIELD_FOR_STORING_FILE_ID' => 'file_id',
  38. 'FIELD_TITLE' => 'title',
  39. 'FIELD_CATEGORY' => 'cat',
  40. 'FIELD_TEXT' => 'desc',
  41. 'FIELD_TEXT_ID' => 'file-desc',
  42. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  43. 'FIELD_CF' => 'cf',
  44. 'FIELD_PHOTO' => 'attachments',
  45. 'FIELD_VIEWS' => 'views',
  46. 'FIELD_COMMENTS' => 'comments',
  47. 'FIELD_STATUS' => 'status',
  48. 'FIELD_STATUS_ADMIN' => 'status_admin',
  49. 'FIELD_LOCATION' => 'location',
  50. 'FIELD_LOCATION_PREFIX' => 'location',
  51. 'FIELD_LABELS' => 'labels',
  52. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  53. 'FIELD_BOOKMARKS_ID' => 'object_id',
  54. 'FIELD_BOOKMARKS_PROFILE' => 'profile_id',
  55. 'FIELD_MIME_TYPE' => 'mime_type',
  56. // page URIs
  57. 'URI_VIEW_ENTRY' => 'view-file',
  58. 'URI_AUTHOR_ENTRIES' => 'files-author',
  59. 'URI_ENTRIES_BY_CONTEXT' => 'files-context',
  60. 'URI_ADD_ENTRY' => 'create-file',
  61. 'URI_EDIT_ENTRY' => 'edit-file',
  62. 'URI_MANAGE_COMMON' => 'files-manage',
  63. 'URI_FAVORITES_LIST' => 'files-favorites',
  64. 'URL_HOME' => 'page.php?i=files-home',
  65. 'URL_POPULAR' => 'page.php?i=files-popular',
  66. 'URL_TOP' => 'page.php?i=files-top',
  67. 'URL_UPDATED' => 'page.php?i=files-updated',
  68. 'URL_MANAGE_COMMON' => 'page.php?i=files-manage',
  69. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=files-administration',
  70. 'URL_DOWNLOAD' => 'modules/?r=files/download/{file_download_token}/{content_id}.{file_ext}',
  71. // some params
  72. 'PARAM_AUTO_APPROVE' => 'bx_files_enable_auto_approve',
  73. 'PARAM_CHARS_SUMMARY' => 'bx_files_summary_chars',
  74. 'PARAM_CHARS_SUMMARY_PLAIN' => '',
  75. 'PARAM_NUM_RSS' => 'bx_files_rss_num',
  76. 'PARAM_SEARCHABLE_FIELDS' => 'bx_files_searchable_fields',
  77. 'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_files_per_page_browse_showcase',
  78. 'PARAM_PER_PAGE_FOR_FAVORITES_LISTS' => 'bx_files_per_page_for_favorites_lists',
  79. 'PARAM_LINK_TO_PREVIEW' => 'bx_files_show_link_to_preview',
  80. 'PARAM_MAX_NESTING_LEVEL' => 'bx_files_max_nesting_level',
  81. 'PARAM_MAX_BULK_DOWNLOAD_SIZE' => 'bx_files_max_bulk_download_size',
  82. 'PARAM_ALLOWED_EXT' => 'bx_files_allowed_ext',
  83. 'PARAM_DEFAULT_LAYOUT_MODE' => 'bx_files_default_layout_mode',
  84. // objects
  85. 'OBJECT_STORAGE' => 'bx_files_files',
  86. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_files_preview',
  87. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_files_gallery',
  88. 'OBJECT_SOUNDS_TRANSCODER' => 'bx_files_sounds_mp3',
  89. 'OBJECT_VIDEOS_TRANSCODERS' => [
  90. 'poster' => 'bx_files_videos_poster',
  91. 'poster_preview' => 'bx_files_videos_poster_preview',
  92. 'mp4' => 'bx_files_videos_mp4',
  93. 'mp4_hd' => 'bx_files_videos_mp4_hd'
  94. ],
  95. 'OBJECT_REPORTS' => 'bx_files',
  96. 'OBJECT_VIEWS' => 'bx_files',
  97. 'OBJECT_VOTES' => 'bx_files',
  98. 'OBJECT_REACTIONS' => 'bx_files_reactions',
  99. 'OBJECT_SCORES' => 'bx_files',
  100. 'OBJECT_FAVORITES' => 'bx_files',
  101. 'OBJECT_FEATURED' => 'bx_files',
  102. 'OBJECT_METATAGS' => 'bx_files',
  103. 'OBJECT_COMMENTS' => 'bx_files',
  104. 'OBJECT_NOTES' => 'bx_files_notes',
  105. 'OBJECT_CATEGORY' => 'bx_files_cats',
  106. 'OBJECT_PRIVACY_VIEW' => 'bx_files_allow_view_to',
  107. 'OBJECT_PRIVACY_LIST_VIEW' => 'bx_files_allow_view_favorite_list',
  108. 'OBJECT_FORM_ENTRY_UPLOAD' => 'bx_files_upload',
  109. 'OBJECT_FORM_ENTRY_DISPLAY_UPLOAD' => 'bx_files_entry_upload',
  110. 'OBJECT_FORM_ENTRY' => 'bx_files',
  111. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_files_entry_view',
  112. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_files_entry_edit',
  113. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_files_entry_edit',
  114. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_files_entry_delete',
  115. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_files_view', // actions menu on view entry page
  116. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_files_view_actions', // all actions menu on view entry page
  117. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_files_my', // actions menu on my entries page
  118. 'OBJECT_MENU_SUBMENU' => 'bx_files_submenu', // main module submenu
  119. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_files_view_submenu', // view entry submenu
  120. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'files-home', // first item in view entry submenu from main module submenu
  121. 'OBJECT_MENU_SNIPPET_META' => 'bx_files_snippet_meta', // menu for snippet meta info
  122. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_files_menu_manage_tools', //manage menu in content administration tools
  123. 'OBJECT_GRID_ADMINISTRATION' => 'bx_files_administration',
  124. 'OBJECT_GRID_COMMON' => 'bx_files_common',
  125. 'OBJECT_UPLOADERS' => array('sys_html5'),
  126. 'BADGES_AVALIABLE' => true,
  127. // menu items which visibility depends on custom visibility checking
  128. 'MENU_ITEM_TO_METHOD' => array (
  129. 'bx_files_my' => array (
  130. 'create-file' => 'checkAllowedAdd',
  131. ),
  132. 'bx_files_view' => $aMenuItems2Methods,
  133. ),
  134. // informer messages
  135. 'INFORMERS' => array (
  136. 'approving' => array (
  137. 'name' => 'bx-files-approving',
  138. 'map' => array (
  139. 'pending' => array('msg' => '_bx_files_txt_msg_status_pending', 'type' => BX_INFORMER_ALERT),
  140. 'hidden' => array('msg' => '_bx_files_txt_msg_status_hidden', 'type' => BX_INFORMER_ERROR),
  141. ),
  142. ),
  143. ),
  144. // some language keys
  145. 'T' => array (
  146. 'txt_sample_single' => '_bx_files_txt_sample_single',
  147. 'txt_sample_single_with_article' => '_bx_files_txt_sample_single_with_article',
  148. 'txt_sample_comment_single' => '_bx_files_txt_sample_comment_single',
  149. 'txt_sample_vote_single' => '_bx_files_txt_sample_vote_single',
  150. 'txt_sample_reaction_single' => '_bx_files_txt_sample_reaction_single',
  151. 'txt_sample_score_up_single' => '_bx_files_txt_sample_score_up_single',
  152. 'txt_sample_score_down_single' => '_bx_files_txt_sample_score_down_single',
  153. 'form_field_author' => '_bx_files_form_entry_input_author',
  154. 'form_entry_upload_single_for_update' => '_bx_files_form_entry_input_pictures_upload',
  155. 'grid_action_err_delete' => '_bx_files_grid_action_err_delete',
  156. 'grid_txt_account_manager' => '_bx_files_grid_txt_account_manager',
  157. 'filter_item_active' => '_bx_files_grid_filter_item_title_adm_active',
  158. 'filter_item_hidden' => '_bx_files_grid_filter_item_title_adm_hidden',
  159. 'filter_item_pending' => '_bx_files_grid_filter_item_title_adm_pending',
  160. 'filter_item_select_one_filter1' => '_bx_files_grid_filter_item_title_adm_select_one_filter1',
  161. 'filter_item_select_one_filter2' => '_bx_files_grid_filter_item_title_adm_select_one_filter2',
  162. 'menu_item_manage_my' => '_bx_files_menu_item_title_manage_my',
  163. 'menu_item_manage_all' => '_bx_files_menu_item_title_manage_all',
  164. 'txt_all_entries_by' => '_bx_files_txt_all_entries_by',
  165. 'txt_all_entries_in' => '_bx_files_txt_all_entries_in',
  166. 'txt_all_entries_by_author' => '_bx_files_page_title_browse_by_author',
  167. 'txt_all_entries_by_context' => '_bx_files_page_title_browse_by_context',
  168. ),
  169. );
  170. $this->_aJsClasses = array(
  171. 'manage_tools' => 'BxFilesManageTools',
  172. 'toolbar_tools' => 'BxFilesBrowserTools',
  173. );
  174. $this->_aJsObjects = array(
  175. 'manage_tools' => 'oBxFilesManageTools',
  176. 'toolbar_tools' => 'oBxFilesBrowserTools',
  177. );
  178. $this->_aGridObjects = array(
  179. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  180. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  181. );
  182. }
  183. public function getJsClass($mixedType)
  184. {
  185. if (is_array($mixedType)) {
  186. return parent::getJsClass($mixedType['type']);
  187. } else {
  188. return parent::getJsClass($mixedType);
  189. }
  190. }
  191. public function getJsObject($mixedType)
  192. {
  193. if (is_array($mixedType)) {
  194. return parent::getJsObject($mixedType['type']).$mixedType['uniq'];
  195. } else {
  196. return parent::getJsObject($mixedType);
  197. }
  198. }
  199. }
  200. /** @} */