BxFilesConfig.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. 'download-file' => 'checkAllowedView',
  18. 'edit-file' => 'checkAllowedEdit',
  19. 'delete-file' => 'checkAllowedDelete',
  20. );
  21. $this->CNF = array (
  22. // module icon
  23. 'ICON' => 'far file col-red3',
  24. // database tables
  25. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'main',
  26. 'TABLE_ENTRIES_FULLTEXT' => 'search_fields',
  27. 'TABLE_FILES' => $aModule['db_prefix'] . 'files',
  28. 'TABLE_BOOKMARKS' => $aModule['db_prefix'] . 'bookmarks',
  29. 'TABLE_FOLDERS' => $aModule['db_prefix'] . 'folders',
  30. // database fields
  31. 'FIELD_ID' => 'id',
  32. 'FIELD_AUTHOR' => 'author',
  33. 'FIELD_ADDED' => 'added',
  34. 'FIELD_CHANGED' => 'changed',
  35. 'FIELD_FILE_ID' => 'file_id',
  36. 'FIELD_FOR_STORING_FILE_ID' => 'file_id',
  37. 'FIELD_TITLE' => 'title',
  38. 'FIELD_CATEGORY' => 'cat',
  39. 'FIELD_TEXT' => 'desc',
  40. 'FIELD_TEXT_ID' => 'file-desc',
  41. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  42. 'FIELD_PHOTO' => 'attachments',
  43. 'FIELD_VIEWS' => 'views',
  44. 'FIELD_COMMENTS' => 'comments',
  45. 'FIELD_STATUS' => 'status',
  46. 'FIELD_STATUS_ADMIN' => 'status_admin',
  47. 'FIELD_LOCATION' => 'location',
  48. 'FIELD_LOCATION_PREFIX' => 'location',
  49. 'FIELD_LABELS' => 'labels',
  50. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  51. 'FIELD_BOOKMARKS_ID' => 'object_id',
  52. 'FIELD_BOOKMARKS_PROFILE' => 'profile_id',
  53. 'FIELD_MIME_TYPE' => 'mime_type',
  54. // some params
  55. 'PARAM_PER_PAGE_FOR_FAVORITES_LISTS' => 'bx_files_per_page_for_favorites_lists',
  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. // some params
  71. 'PARAM_CHARS_SUMMARY' => 'bx_files_summary_chars',
  72. 'PARAM_CHARS_SUMMARY_PLAIN' => '',
  73. 'PARAM_NUM_RSS' => 'bx_files_rss_num',
  74. 'PARAM_SEARCHABLE_FIELDS' => 'bx_files_searchable_fields',
  75. 'PARAM_LINK_TO_PREVIEW' => 'bx_files_show_link_to_preview',
  76. 'PARAM_MAX_NESTING_LEVEL' => 'bx_files_max_nesting_level',
  77. 'PARAM_MAX_BULK_DOWNLOAD_SIZE' => 'bx_files_max_bulk_download_size',
  78. // objects
  79. 'OBJECT_STORAGE' => 'bx_files_files',
  80. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_files_preview',
  81. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_files_gallery',
  82. 'OBJECT_VIDEOS_TRANSCODERS' => array(),
  83. 'OBJECT_REPORTS' => 'bx_files',
  84. 'OBJECT_VIEWS' => 'bx_files',
  85. 'OBJECT_VOTES' => 'bx_files',
  86. 'OBJECT_REACTIONS' => 'bx_files_reactions',
  87. 'OBJECT_SCORES' => 'bx_files',
  88. 'OBJECT_FAVORITES' => 'bx_files',
  89. 'OBJECT_FEATURED' => 'bx_files',
  90. 'OBJECT_METATAGS' => 'bx_files',
  91. 'OBJECT_COMMENTS' => 'bx_files',
  92. 'OBJECT_NOTES' => 'bx_files_notes',
  93. 'OBJECT_CATEGORY' => 'bx_files_cats',
  94. 'OBJECT_PRIVACY_VIEW' => 'bx_files_allow_view_to',
  95. 'OBJECT_PRIVACY_LIST_VIEW' => 'bx_files_allow_view_favorite_list',
  96. 'OBJECT_FORM_ENTRY_UPLOAD' => 'bx_files_upload',
  97. 'OBJECT_FORM_ENTRY_DISPLAY_UPLOAD' => 'bx_files_entry_upload',
  98. 'OBJECT_FORM_ENTRY' => 'bx_files',
  99. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_files_entry_view',
  100. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_files_entry_edit',
  101. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_files_entry_edit',
  102. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_files_entry_delete',
  103. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_files_view', // actions menu on view entry page
  104. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_files_view_actions', // all actions menu on view entry page
  105. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_files_my', // actions menu on my entries page
  106. 'OBJECT_MENU_SUBMENU' => 'bx_files_submenu', // main module submenu
  107. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_files_view_submenu', // view entry submenu
  108. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'files-home', // first item in view entry submenu from main module submenu
  109. 'OBJECT_MENU_SNIPPET_META' => 'bx_files_snippet_meta', // menu for snippet meta info
  110. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_files_menu_manage_tools', //manage menu in content administration tools
  111. 'OBJECT_GRID_ADMINISTRATION' => 'bx_files_administration',
  112. 'OBJECT_GRID_COMMON' => 'bx_files_common',
  113. 'OBJECT_UPLOADERS' => array('sys_simple', 'sys_html5'),
  114. // menu items which visibility depends on custom visibility checking
  115. 'MENU_ITEM_TO_METHOD' => array (
  116. 'bx_files_my' => array (
  117. 'create-file' => 'checkAllowedAdd',
  118. ),
  119. 'bx_files_view' => $aMenuItems2Methods,
  120. ),
  121. // some language keys
  122. 'T' => array (
  123. 'txt_sample_single' => '_bx_files_txt_sample_single',
  124. 'txt_sample_single_with_article' => '_bx_files_txt_sample_single_with_article',
  125. 'txt_sample_comment_single' => '_bx_files_txt_sample_comment_single',
  126. 'txt_sample_vote_single' => '_bx_files_txt_sample_vote_single',
  127. 'txt_sample_reaction_single' => '_bx_files_txt_sample_reaction_single',
  128. 'txt_sample_score_up_single' => '_bx_files_txt_sample_score_up_single',
  129. 'txt_sample_score_down_single' => '_bx_files_txt_sample_score_down_single',
  130. 'form_field_author' => '_bx_files_form_entry_input_author',
  131. 'form_entry_upload_single_for_update' => '_bx_files_form_entry_input_pictures_upload',
  132. 'grid_action_err_delete' => '_bx_files_grid_action_err_delete',
  133. 'grid_txt_account_manager' => '_bx_files_grid_txt_account_manager',
  134. 'filter_item_active' => '_bx_files_grid_filter_item_title_adm_active',
  135. 'filter_item_hidden' => '_bx_files_grid_filter_item_title_adm_hidden',
  136. 'filter_item_select_one_filter1' => '_bx_files_grid_filter_item_title_adm_select_one_filter1',
  137. 'menu_item_manage_my' => '_bx_files_menu_item_title_manage_my',
  138. 'menu_item_manage_all' => '_bx_files_menu_item_title_manage_all',
  139. 'txt_all_entries_by' => '_bx_files_txt_all_entries_by',
  140. 'txt_all_entries_in' => '_bx_files_txt_all_entries_in',
  141. 'txt_all_entries_by_author' => '_bx_files_page_title_browse_by_author',
  142. 'txt_all_entries_by_context' => '_bx_files_page_title_browse_by_context',
  143. ),
  144. );
  145. $this->_aJsClasses = array(
  146. 'manage_tools' => 'BxFilesManageTools',
  147. 'toolbar_tools' => 'BxFilesBrowserTools',
  148. );
  149. $this->_aJsObjects = array(
  150. 'manage_tools' => 'oBxFilesManageTools',
  151. 'toolbar_tools' => 'oBxFilesBrowserTools',
  152. );
  153. $this->_aGridObjects = array(
  154. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  155. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  156. );
  157. }
  158. public function getJsClass($mixedType)
  159. {
  160. if (is_array($mixedType)) {
  161. return parent::getJsClass($mixedType['type']);
  162. } else {
  163. return parent::getJsClass($mixedType);
  164. }
  165. }
  166. public function getJsObject($mixedType)
  167. {
  168. if (is_array($mixedType)) {
  169. return parent::getJsObject($mixedType['type']).$mixedType['uniq'];
  170. } else {
  171. return parent::getJsObject($mixedType);
  172. }
  173. }
  174. }
  175. /** @} */