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