1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00

add ABOUT_DIALOG_CUSTOM_HTML (#4734)

Co-authored-by: lian <lian@seafile.com>
This commit is contained in:
lian
2020-12-02 21:31:17 +08:00
committed by GitHub
parent 248fe2e1f0
commit 06b55feae6
4 changed files with 35 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Modal, ModalBody } from 'reactstrap'; import { Modal, ModalBody } from 'reactstrap';
import { gettext, lang, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle, seafileVersion, additionalAboutDialogLinks } from '../../utils/constants'; import { gettext, lang, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle, seafileVersion, additionalAboutDialogLinks, aboutDialogCustomHtml } from '../../utils/constants';
const propTypes = { const propTypes = {
onCloseAboutDialog: PropTypes.func.isRequired, onCloseAboutDialog: PropTypes.func.isRequired,
@@ -24,21 +24,33 @@ class AboutDialog extends React.Component {
} }
render() { render() {
let href = lang === lang == 'zh-cn' ? 'http://seafile.com/about/' : 'http://seafile.com/en/about/'; let href = lang === lang == 'zh-cn' ? 'http://seafile.com/about/' : 'http://seafile.com/en/about/';
return ( if (aboutDialogCustomHtml) {
<Modal isOpen={true} toggle={this.toggle}> return (
<ModalBody> <Modal isOpen={true} toggle={this.toggle}>
<button type="button" className="close" onClick={this.toggle}><span aria-hidden="true">×</span></button> <ModalBody>
<div className="about-content"> <button type="button" className="close" onClick={this.toggle}><span aria-hidden="true">×</span></button>
<p><img src={mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" /></p> <div className="about-content" dangerouslySetInnerHTML={{__html: aboutDialogCustomHtml}}></div>
<p>{gettext('Server Version: ')}{seafileVersion}<br />© 2020 {gettext('Seafile')}</p> </ModalBody>
<p>{this.renderExternalAboutLinks()}</p> </Modal>
<p><a href={href} target="_blank">{gettext('About Us')}</a></p> );
</div> } else {
</ModalBody> return (
</Modal> <Modal isOpen={true} toggle={this.toggle}>
); <ModalBody>
<button type="button" className="close" onClick={this.toggle}><span aria-hidden="true">×</span></button>
<div className="about-content">
<p><img src={mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" /></p>
<p>{gettext('Server Version: ')}{seafileVersion}<br />© 2020 {gettext('Seafile')}</p>
<p>{this.renderExternalAboutLinks()}</p>
<p><a href={href} target="_blank">{gettext('About Us')}</a></p>
</div>
</ModalBody>
</Modal>
);
}
} }
} }

View File

@@ -48,6 +48,7 @@ export const shareLinkPasswordMinLength = window.app.pageOptions.shareLinkPasswo
export const shareLinkExpireDaysMin = window.app.pageOptions.shareLinkExpireDaysMin; export const shareLinkExpireDaysMin = window.app.pageOptions.shareLinkExpireDaysMin;
export const shareLinkExpireDaysMax = window.app.pageOptions.shareLinkExpireDaysMax; export const shareLinkExpireDaysMax = window.app.pageOptions.shareLinkExpireDaysMax;
export const sideNavFooterCustomHtml = window.app.pageOptions.sideNavFooterCustomHtml; export const sideNavFooterCustomHtml = window.app.pageOptions.sideNavFooterCustomHtml;
export const aboutDialogCustomHtml = window.app.pageOptions.aboutDialogCustomHtml;
export const shareLinkExpireDaysDefault = window.app.pageOptions.shareLinkExpireDaysDefault; export const shareLinkExpireDaysDefault = window.app.pageOptions.shareLinkExpireDaysDefault;
export const uploadLinkExpireDaysMin = window.app.pageOptions.uploadLinkExpireDaysMin; export const uploadLinkExpireDaysMin = window.app.pageOptions.uploadLinkExpireDaysMin;
export const uploadLinkExpireDaysMax = window.app.pageOptions.uploadLinkExpireDaysMax; export const uploadLinkExpireDaysMax = window.app.pageOptions.uploadLinkExpireDaysMax;

View File

@@ -52,6 +52,11 @@ try:
except ImportError: except ImportError:
SIDE_NAV_FOOTER_CUSTOM_HTML = '' SIDE_NAV_FOOTER_CUSTOM_HTML = ''
try:
from seahub.settings import ABOUT_DIALOG_CUSTOM_HTML
except ImportError:
ABOUT_DIALOG_CUSTOM_HTML = ''
def base(request): def base(request):
""" """
@@ -144,6 +149,7 @@ def base(request):
'privacy_policy_link': PRIVACY_POLICY_LINK, 'privacy_policy_link': PRIVACY_POLICY_LINK,
'terms_of_service_link': TERMS_OF_SERVICE_LINK, 'terms_of_service_link': TERMS_OF_SERVICE_LINK,
'side_nav_footer_custom_html': SIDE_NAV_FOOTER_CUSTOM_HTML, 'side_nav_footer_custom_html': SIDE_NAV_FOOTER_CUSTOM_HTML,
'about_dialog_custom_html': ABOUT_DIALOG_CUSTOM_HTML,
} }
if request.user.is_staff: if request.user.is_staff:
@@ -152,6 +158,7 @@ def base(request):
return result return result
def debug(request): def debug(request):
""" """
Returns context variables helpful for debugging. Returns context variables helpful for debugging.

View File

@@ -92,6 +92,7 @@
enableRepoSnapshotLabel: {% if enable_repo_snapshot_label %} true {% else %} false {% endif %}, enableRepoSnapshotLabel: {% if enable_repo_snapshot_label %} true {% else %} false {% endif %},
shareLinkPasswordMinLength: {{ share_link_password_min_length }}, shareLinkPasswordMinLength: {{ share_link_password_min_length }},
sideNavFooterCustomHtml: "{{ side_nav_footer_custom_html|safe|escapejs }}", sideNavFooterCustomHtml: "{{ side_nav_footer_custom_html|safe|escapejs }}",
aboutDialogCustomHtml: "{{ about_dialog_custom_html|safe|escapejs }}",
maxFileName: "{{ max_file_name }}", maxFileName: "{{ max_file_name }}",
canPublishRepo: {% if user.permissions.can_publish_repo %} true {% else %} false {% endif %}, canPublishRepo: {% if user.permissions.can_publish_repo %} true {% else %} false {% endif %},
enableEncryptedLibrary: {% if enable_encrypted_library %} true {% else %} false {% endif %}, enableEncryptedLibrary: {% if enable_encrypted_library %} true {% else %} false {% endif %},