BxFilesConfig.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. // database fields
  29. 'FIELD_ID' => 'id',
  30. 'FIELD_AUTHOR' => 'author',
  31. 'FIELD_ADDED' => 'added',
  32. 'FIELD_CHANGED' => 'changed',
  33. 'FIELD_FILE_ID' => 'file_id',
  34. 'FIELD_FOR_STORING_FILE_ID' => 'file_id',
  35. 'FIELD_TITLE' => 'title',
  36. 'FIELD_CATEGORY' => 'cat',
  37. 'FIELD_TEXT' => 'desc',
  38. 'FIELD_TEXT_ID' => 'file-desc',
  39. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  40. 'FIELD_PHOTO' => 'attachments',
  41. 'FIELD_VIEWS' => 'views',
  42. 'FIELD_COMMENTS' => 'comments',
  43. 'FIELD_STATUS' => 'status',
  44. 'FIELD_STATUS_ADMIN' => 'status_admin',
  45. 'FIELD_LOCATION_PREFIX' => 'location',
  46. 'FIELD_LABELS' => 'labels',
  47. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  48. // page URIs
  49. 'URI_VIEW_ENTRY' => 'view-file',
  50. 'URI_AUTHOR_ENTRIES' => 'files-author',
  51. 'URI_ENTRIES_BY_CONTEXT' => 'files-context',
  52. 'URI_ADD_ENTRY' => 'create-file',
  53. 'URI_EDIT_ENTRY' => 'edit-file',
  54. 'URI_MANAGE_COMMON' => 'files-manage',
  55. 'URL_HOME' => 'page.php?i=files-home',
  56. 'URL_POPULAR' => 'page.php?i=files-popular',
  57. 'URL_UPDATED' => 'page.php?i=files-updated',
  58. 'URL_MANAGE_COMMON' => 'page.php?i=files-manage',
  59. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=files-administration',
  60. // some params
  61. 'PARAM_CHARS_SUMMARY' => 'bx_files_summary_chars',
  62. 'PARAM_CHARS_SUMMARY_PLAIN' => '',
  63. 'PARAM_NUM_RSS' => 'bx_files_rss_num',
  64. 'PARAM_SEARCHABLE_FIELDS' => 'bx_files_searchable_fields',
  65. // objects
  66. 'OBJECT_STORAGE' => 'bx_files_files',
  67. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_files_preview',
  68. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_files_gallery',
  69. 'OBJECT_VIDEOS_TRANSCODERS' => array(),
  70. 'OBJECT_REPORTS' => 'bx_files',
  71. 'OBJECT_VIEWS' => 'bx_files',
  72. 'OBJECT_VOTES' => 'bx_files',
  73. 'OBJECT_SCORES' => 'bx_files',
  74. 'OBJECT_FAVORITES' => 'bx_files',
  75. 'OBJECT_FEATURED' => 'bx_files',
  76. 'OBJECT_METATAGS' => 'bx_files',
  77. 'OBJECT_COMMENTS' => 'bx_files',
  78. 'OBJECT_CATEGORY' => 'bx_files_cats',
  79. 'OBJECT_PRIVACY_VIEW' => 'bx_files_allow_view_to',
  80. 'OBJECT_FORM_ENTRY' => 'bx_files',
  81. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_files_entry_view',
  82. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_files_entry_edit',
  83. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_files_entry_edit',
  84. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_files_entry_delete',
  85. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_files_view', // actions menu on view entry page
  86. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_files_view_actions', // all actions menu on view entry page
  87. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_files_my', // actions menu on my entries page
  88. 'OBJECT_MENU_SUBMENU' => 'bx_files_submenu', // main module submenu
  89. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_files_view_submenu', // view entry submenu
  90. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'files-home', // first item in view entry submenu from main module submenu
  91. 'OBJECT_MENU_SNIPPET_META' => 'bx_files_snippet_meta', // menu for snippet meta info
  92. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_files_menu_manage_tools', //manage menu in content administration tools
  93. 'OBJECT_GRID_ADMINISTRATION' => 'bx_files_administration',
  94. 'OBJECT_GRID_COMMON' => 'bx_files_common',
  95. 'OBJECT_UPLOADERS' => array('sys_simple', 'sys_html5'),
  96. // menu items which visibility depends on custom visibility checking
  97. 'MENU_ITEM_TO_METHOD' => array (
  98. 'bx_files_my' => array (
  99. 'create-file' => 'checkAllowedAdd',
  100. ),
  101. 'bx_files_view' => $aMenuItems2Methods,
  102. ),
  103. // some language keys
  104. 'T' => array (
  105. 'txt_sample_single' => '_bx_files_txt_sample_single',
  106. 'txt_sample_single_with_article' => '_bx_files_txt_sample_single_with_article',
  107. 'txt_sample_comment_single' => '_bx_files_txt_sample_comment_single',
  108. 'txt_sample_vote_single' => '_bx_files_txt_sample_vote_single',
  109. 'form_field_author' => '_bx_files_form_entry_input_author',
  110. 'form_entry_upload_single_for_update' => '_bx_files_form_entry_input_pictures_upload',
  111. 'grid_action_err_delete' => '_bx_files_grid_action_err_delete',
  112. 'grid_txt_account_manager' => '_bx_files_grid_txt_account_manager',
  113. 'filter_item_active' => '_bx_files_grid_filter_item_title_adm_active',
  114. 'filter_item_hidden' => '_bx_files_grid_filter_item_title_adm_hidden',
  115. 'filter_item_select_one_filter1' => '_bx_files_grid_filter_item_title_adm_select_one_filter1',
  116. 'menu_item_manage_my' => '_bx_files_menu_item_title_manage_my',
  117. 'menu_item_manage_all' => '_bx_files_menu_item_title_manage_all',
  118. 'txt_all_entries_by' => '_bx_files_txt_all_entries_by',
  119. 'txt_all_entries_in' => '_bx_files_txt_all_entries_in',
  120. 'txt_all_entries_by_author' => '_bx_files_page_title_browse_by_author',
  121. 'txt_all_entries_by_context' => '_bx_files_page_title_browse_by_context',
  122. ),
  123. );
  124. $this->_aJsClasses = array(
  125. 'manage_tools' => 'BxFilesManageTools'
  126. );
  127. $this->_aJsObjects = array(
  128. 'manage_tools' => 'oBxFilesManageTools'
  129. );
  130. $this->_aGridObjects = array(
  131. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  132. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  133. );
  134. }
  135. }
  136. /** @} */