diff --git a/frontend/src/components/toolbar/dir-operation-toolbar.js b/frontend/src/components/toolbar/dir-operation-toolbar.js index cebc8a7552..87a4cf4f47 100644 --- a/frontend/src/components/toolbar/dir-operation-toolbar.js +++ b/frontend/src/components/toolbar/dir-operation-toolbar.js @@ -2,7 +2,7 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; import { Utils } from '../../utils/utils'; -import { gettext } from '../../utils/constants'; +import { enableSeadoc, gettext } from '../../utils/constants'; import ModalPortal from '../modal-portal'; import CreateFolder from '../../components/dialog/create-folder-dialog'; import CreateFile from '../../components/dialog/create-file-dialog'; @@ -142,6 +142,13 @@ class DirOperationToolbar extends React.Component { }); } + onCreateSeaDocToggle = () => { + this.setState({ + isCreateFileDialogShow: !this.state.isCreateFileDialogShow, + fileType: '.sdoc' + }); + } + onAddFile = (filePath, isDraft) => { this.setState({isCreateFileDialogShow: false}); this.props.onAddFile(filePath, isDraft); @@ -208,6 +215,7 @@ class DirOperationToolbar extends React.Component { + {enableSeadoc && } )} diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index b05d6d1dd0..30dd60a43f 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -82,6 +82,7 @@ export const enableOCM = window.app.pageOptions.enableOCM; export const ocmRemoteServers = window.app.pageOptions.ocmRemoteServers; export const enableOCMViaWebdav = window.app.pageOptions.enableOCMViaWebdav; export const enableSSOToThirdpartWebsite = window.app.pageOptions.enableSSOToThirdpartWebsite; +export const enableSeadoc = window.app.pageOptions.enableSeadoc; export const curNoteMsg = window.app.pageOptions.curNoteMsg; export const curNoteID = window.app.pageOptions.curNoteID; diff --git a/seahub/base/context_processors.py b/seahub/base/context_processors.py index aceb49b6ec..ba57204374 100644 --- a/seahub/base/context_processors.py +++ b/seahub/base/context_processors.py @@ -24,7 +24,7 @@ from seahub.settings import SEAFILE_VERSION, SITE_DESCRIPTION, \ MEDIA_ROOT, SHOW_LOGOUT_ICON, CUSTOM_LOGO_PATH, CUSTOM_FAVICON_PATH, \ ENABLE_SEAFILE_DOCS, LOGIN_BG_IMAGE_PATH, \ CUSTOM_LOGIN_BG_PATH, ENABLE_SHARE_LINK_REPORT_ABUSE, \ - PRIVACY_POLICY_LINK, TERMS_OF_SERVICE_LINK + PRIVACY_POLICY_LINK, TERMS_OF_SERVICE_LINK, ENABLE_SEADOC from seahub.organizations.models import OrgAdminSettings from seahub.organizations.settings import ORG_ENABLE_ADMIN_CUSTOM_LOGO @@ -162,6 +162,7 @@ def base(request): 'side_nav_footer_custom_html': SIDE_NAV_FOOTER_CUSTOM_HTML, 'about_dialog_custom_html': ABOUT_DIALOG_CUSTOM_HTML, 'enable_repo_auto_del': ENABLE_REPO_AUTO_DEL, + 'enable_seadoc': ENABLE_SEADOC } if request.user.is_staff: diff --git a/seahub/templates/base_for_react.html b/seahub/templates/base_for_react.html index 3bc037d911..bd9fbe1f87 100644 --- a/seahub/templates/base_for_react.html +++ b/seahub/templates/base_for_react.html @@ -142,7 +142,8 @@ additionalAppBottomLinks: {% if additional_app_bottom_links %} {{ additional_app_bottom_links|safe }} {% else %} null {% endif %}, additionalAboutDialogLinks: {% if additional_about_dialog_links %} {{ additional_about_dialog_links|safe }} {% else %} null {% endif %}, enableOnlyoffice: {% if enableOnlyoffice %} true {% else %} false {% endif %}, - onlyofficeConverterExtensions: {% if onlyofficeConverterExtensions %} {{onlyofficeConverterExtensions|safe}} {% else %} null {% endif %} + onlyofficeConverterExtensions: {% if onlyofficeConverterExtensions %} {{onlyofficeConverterExtensions|safe}} {% else %} null {% endif %}, + enableSeadoc: {% if enable_seadoc %} true {% else %} false {% endif %}, } };