From a2cab470afbe6a93abf9162402559bacf4baf6e1 Mon Sep 17 00:00:00 2001 From: llj Date: Wed, 17 Jul 2019 14:49:57 +0800 Subject: [PATCH 01/18] [sys stat reports] fixup (#3864) --- seahub/templates/sysadmin/sys_statistic_reports.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seahub/templates/sysadmin/sys_statistic_reports.html b/seahub/templates/sysadmin/sys_statistic_reports.html index 825ca71748..5d3fe0d3ac 100644 --- a/seahub/templates/sysadmin/sys_statistic_reports.html +++ b/seahub/templates/sysadmin/sys_statistic_reports.html @@ -35,7 +35,8 @@ var d = new Date(); var year = d.getFullYear(); var month = d.getMonth() + 1; - $('#monthly-user-traffic-report [name="month"]').val(year + '' + month); + var str = year + (month < 10 ? '0' : '') + month; + $('#monthly-user-traffic-report [name="month"]').val(str); })(); $('.date-custom-form').on('submit', function() { From accb814d22a9869061dc55f7e6e1f7a21a521c00 Mon Sep 17 00:00:00 2001 From: Michael An <2331806369@qq.com> Date: Wed, 17 Jul 2019 14:54:12 +0800 Subject: [PATCH 02/18] change published repo style and comment (#3865) --- frontend/src/components/dirent-detail/dirent-details.js | 2 +- frontend/src/css/wiki.css | 3 +++ frontend/src/pages/lib-content-view/lib-content-container.js | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/dirent-detail/dirent-details.js b/frontend/src/components/dirent-detail/dirent-details.js index 6a8b436f80..2e2afaf70e 100644 --- a/frontend/src/components/dirent-detail/dirent-details.js +++ b/frontend/src/components/dirent-detail/dirent-details.js @@ -225,7 +225,7 @@ class DirentDetail extends React.Component { diff --git a/frontend/src/css/wiki.css b/frontend/src/css/wiki.css index d659170552..9da2de4245 100644 --- a/frontend/src/css/wiki.css +++ b/frontend/src/css/wiki.css @@ -39,6 +39,9 @@ .wiki-pages-container .article { padding: 0 20px; } +.wiki-pages-container .tree-view { + margin-top: 14px; +} .wiki-md-viewer-rendered-content { padding: 30px 0 0; diff --git a/frontend/src/pages/lib-content-view/lib-content-container.js b/frontend/src/pages/lib-content-view/lib-content-container.js index d8e5ebba76..470c1c289d 100644 --- a/frontend/src/pages/lib-content-view/lib-content-container.js +++ b/frontend/src/pages/lib-content-view/lib-content-container.js @@ -143,7 +143,8 @@ class LibContentContainer extends React.Component { } checkCurrentDirent = (deletedDirent) => { - if (deletedDirent.name === this.state.currentDirent.name) { + let { currentDirent } = this.state; + if (currentDirent && deletedDirent.name === currentDirent.name) { this.setState({currentDirent: null}); } } From 694900e82b539476ae84526da188652b2edfe58e Mon Sep 17 00:00:00 2001 From: llj Date: Wed, 17 Jul 2019 17:34:22 +0800 Subject: [PATCH 03/18] [shared file view] added modification for 'preview only' (#3867) --- .../shared-file-view/shared-file-view.js | 19 +++++++++++++++++-- seahub/templates/shared_file_view_react.html | 14 +++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/shared-file-view/shared-file-view.js b/frontend/src/components/shared-file-view/shared-file-view.js index 34fcf7edd4..fc4b61cc05 100644 --- a/frontend/src/components/shared-file-view/shared-file-view.js +++ b/frontend/src/components/shared-file-view/shared-file-view.js @@ -15,7 +15,7 @@ const propTypes = { }; let loginUser = window.app.pageOptions.name; -const { repoID, sharedToken, trafficOverLimit, fileName, fileSize, sharedBy, siteName, enableWatermark, download, zipped, filePath } = window.shared.pageOptions; +const { repoID, sharedToken, trafficOverLimit, fileName, fileSize, sharedBy, siteName, enableWatermark, canDownload, zipped, filePath } = window.shared.pageOptions; class SharedFileView extends React.Component { @@ -50,6 +50,21 @@ class SharedFileView extends React.Component { duration: 3 }); } + if (!canDownload) { + document.addEventListener('contextmenu', function(e) { + e.preventDefault(); + return false; + }); + document.addEventListener('keydown', function(e) { + // prevent ctrl + s/p/a/c, i.e, 'save', 'print', 'select all', 'copy' + // metaKey: for mac + if ((e.ctrlKey || e.metaKey) && (e.which == 83 || e.which == 80 || e.which == 65 || e.which == 67)) { + e.preventDefault(); + e.stopPropagation(); + return false; + } + }); + } } renderPath = () => { @@ -91,7 +106,7 @@ class SharedFileView extends React.Component {

{gettext('Shared by:')}{' '}{sharedBy}

} - {download && + {canDownload &&
{(loginUser && loginUser !== sharedBy) &&