mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 15:38:15 +00:00
Remove some features from the open source version (#3192)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Modal, ModalHeader, Input, ModalBody, ModalFooter, Form, FormGroup, Label, Alert } from 'reactstrap';
|
||||
import { gettext } from '../../utils/constants';
|
||||
import { gettext, isDocs } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
@@ -136,7 +136,7 @@ class CreateFile extends React.Component {
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
{this.props.fileType == '.md' && (
|
||||
{this.props.fileType == '.md' && isDocs && (
|
||||
<FormGroup check>
|
||||
<Label check>
|
||||
<Input type="checkbox" onChange={this.handleCheck}/>{' '}{gettext('This is a draft')}
|
||||
|
@@ -6,7 +6,7 @@ import { gettext, siteRoot, enableWiki, canAddRepo, canGenerateShareLink, canGen
|
||||
import { seafileAPI } from '../utils/seafile-api';
|
||||
import { Badge } from 'reactstrap';
|
||||
|
||||
import { canViewOrg } from '../utils/constants';
|
||||
import { canViewOrg, isDocs } from '../utils/constants';
|
||||
|
||||
const propTypes = {
|
||||
currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||
@@ -189,12 +189,14 @@ class MainSideNav extends React.Component {
|
||||
<span className="nav-text">{gettext('Favorites')}</span>
|
||||
</Link>
|
||||
</li>
|
||||
{isDocs &&
|
||||
<li className="nav-item">
|
||||
<Link className={`nav-link ellipsis ${this.getActiveClass('dashboard')}`} to={siteRoot + 'dashboard/'} title={gettext('Activities')} onClick={() => this.tabItemClick('dashboard')}>
|
||||
<span className="sf2-icon-clock" aria-hidden="true"></span>
|
||||
<span className="nav-text">{gettext('Activities')}</span>
|
||||
</Link>
|
||||
</li>
|
||||
}
|
||||
{enableWiki &&
|
||||
<li className="nav-item">
|
||||
<Link className={`nav-link ellipsis ${this.getActiveClass('wikis')}`} to={siteRoot + 'wikis/'} title={gettext('Wikis')} onClick={() => this.tabItemClick('wikis')}>
|
||||
@@ -203,6 +205,7 @@ class MainSideNav extends React.Component {
|
||||
</Link>
|
||||
</li>
|
||||
}
|
||||
{isDocs &&
|
||||
<li className="nav-item" onClick={() => this.tabItemClick('drafts')}>
|
||||
<Link className={`nav-link ellipsis ${this.getActiveClass('drafts')}`} to={siteRoot + 'drafts/'} title={gettext('Drafts')}>
|
||||
<span className="sf2-icon-edit" aria-hidden="true"></span>
|
||||
@@ -212,6 +215,7 @@ class MainSideNav extends React.Component {
|
||||
</span>
|
||||
</Link>
|
||||
</li>
|
||||
}
|
||||
<li className="nav-item">
|
||||
<Link className={`nav-link ellipsis ${this.getActiveClass('linked-devices')}`} to={siteRoot + 'linked-devices/'} title={gettext('Linked Devices')} onClick={() => this.tabItemClick('linked-devices')}>
|
||||
<span className="sf2-icon-monitor" aria-hidden="true"></span>
|
||||
|
@@ -5,6 +5,7 @@ import { IconButton, ButtonGroup, CollabUsersButton } from '@seafile/seafile-edi
|
||||
import FileInfo from '@seafile/seafile-editor/dist/components/topbarcomponent/file-info';
|
||||
|
||||
const propTypes = {
|
||||
isDocs: PropTypes.bool.isRequired,
|
||||
hasDraft: PropTypes.bool.isRequired,
|
||||
isDraft: PropTypes.bool.isRequired,
|
||||
editorUtilities: PropTypes.object.isRequired,
|
||||
@@ -42,7 +43,7 @@ class MarkdownViewerToolbar extends React.Component {
|
||||
</div>
|
||||
}
|
||||
<div className="topbar-btn-container">
|
||||
{ (!this.props.hasDraft && !this.props.isDraft) &&
|
||||
{ (!this.props.hasDraft && !this.props.isDraft && this.props.isDocs) &&
|
||||
<button onMouseDown={this.props.toggleNewDraft} className="btn btn-success btn-new-draft">
|
||||
{gettext('New Draft')}</button>
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import 'whatwg-fetch';
|
||||
import { Value, Document, Block } from 'slate';
|
||||
import { seafileAPI } from './utils/seafile-api';
|
||||
import { Utils } from './utils/utils';
|
||||
import { gettext } from './utils/constants';
|
||||
import { gettext, isDocs } from './utils/constants';
|
||||
import io from 'socket.io-client';
|
||||
import toaster from './components/toast';
|
||||
import ModalPortal from './components/modal-portal';
|
||||
@@ -909,6 +909,11 @@ class MarkdownEditor extends React.Component {
|
||||
}
|
||||
|
||||
toggleHistory = () => {
|
||||
if (!isDocs) {
|
||||
window.location.href = siteRoot + 'repo/file_revisions/' + repoID + '/?p=' + Utils.encodePath(filePath);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.state.isShowHistory) {
|
||||
this.setState({
|
||||
isShowHistory: false,
|
||||
@@ -972,6 +977,7 @@ class MarkdownEditor extends React.Component {
|
||||
component = (
|
||||
<div className="seafile-md-viewer d-flex flex-column">
|
||||
<MarkdownViewerToolbar
|
||||
isDocs={isDocs}
|
||||
hasDraft={hasDraft}
|
||||
isDraft={isDraft}
|
||||
editorUtilities={editorUtilities}
|
||||
|
@@ -11,6 +11,7 @@ export const siteName = window.app.config.siteName;
|
||||
export const logoWidth = window.app.config.logoWidth;
|
||||
export const logoHeight = window.app.config.logoHeight;
|
||||
export const isPro = window.app.config.isPro === 'True';
|
||||
export const isDocs = window.app.config.isDocs === 'True';
|
||||
export const lang = window.app.config.lang;
|
||||
export const fileServerRoot = window.app.config.fileServerRoot;
|
||||
export const seafileVersion = window.app.config.seafileVersion;
|
||||
|
@@ -29,7 +29,7 @@ try:
|
||||
except ImportError:
|
||||
SEACLOUD_MODE = False
|
||||
|
||||
from seahub.utils import HAS_FILE_SEARCH, EVENTS_ENABLED, is_pro_version
|
||||
from seahub.utils import HAS_FILE_SEARCH, EVENTS_ENABLED, is_pro_version, is_docs_version
|
||||
|
||||
try:
|
||||
from seahub.settings import ENABLE_PUBFILE
|
||||
@@ -121,6 +121,7 @@ def base(request):
|
||||
'enable_terms_and_conditions': config.ENABLE_TERMS_AND_CONDITIONS,
|
||||
'show_logout_icon': SHOW_LOGOUT_ICON,
|
||||
'is_pro': True if is_pro_version() else False,
|
||||
'is_docs': True if is_docs_version() else False,
|
||||
'enable_repo_wiki_mode': dj_settings.ENABLE_REPO_WIKI_MODE,
|
||||
'enable_upload_folder': dj_settings.ENABLE_UPLOAD_FOLDER,
|
||||
'enable_resumable_fileupload': dj_settings.ENABLE_RESUMABLE_FILEUPLOAD,
|
||||
|
@@ -35,6 +35,7 @@
|
||||
siteRoot: '{{ SITE_ROOT }}',
|
||||
loginUrl: '{{ LOGIN_URL }}',
|
||||
isPro: '{{ is_pro }}',
|
||||
isDocs: '{{ is_docs }}',
|
||||
lang: '{{ LANGUAGE_CODE }}',
|
||||
fileServerRoot: '{{ FILE_SERVER_ROOT }}',
|
||||
serviceURL: '{{ service_url }}',
|
||||
|
@@ -22,6 +22,7 @@
|
||||
siteRoot: '{{ SITE_ROOT }}',
|
||||
serviceUrl: '{{ serviceUrl }}',
|
||||
isPro: '{{ is_pro }}',
|
||||
isDocs: '{{ is_docs }}',
|
||||
seafileCollabServer: '{{ seafile_collab_server}}',
|
||||
},
|
||||
pageOptions: {
|
||||
|
@@ -83,6 +83,15 @@ def is_pro_version():
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
def is_docs_version():
|
||||
is_docs_version = True
|
||||
try:
|
||||
import seafevents
|
||||
except ImportError:
|
||||
is_docs_version = False
|
||||
|
||||
return is_docs_version
|
||||
|
||||
def is_cluster_mode():
|
||||
cfg = ConfigParser.ConfigParser()
|
||||
if 'SEAFILE_CENTRAL_CONF_DIR' in os.environ:
|
||||
|
Reference in New Issue
Block a user