1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

[sdoc] 'shared file view': display 'share permission' & 'download' icon (if it can be downloaded)

This commit is contained in:
llj
2023-08-30 18:24:39 +08:00
parent 68bbb9d306
commit 66885a58b2
8 changed files with 34 additions and 6 deletions

View File

@@ -10,9 +10,16 @@ const { serviceURL, siteRoot, avatarURL } = window.app.config;
const { username } = window.app.pageOptions; const { username } = window.app.pageOptions;
const { const {
repoID, filePerm, repoID, filePerm,
canDownload, canEdit,
trafficOverLimit, zipped,
docPath, docName, docUuid, seadocAccessToken, seadocServerUrl, assetsUrl docPath, docName, docUuid, seadocAccessToken, seadocServerUrl, assetsUrl
} = window.shared.pageOptions; } = window.shared.pageOptions;
// share permission of this sdoc
const sharePermission = {'can_edit': canEdit, 'can_download': canDownload, 'can_upload': false};
const sharePermissionStr = Utils.getShareLinkPermissionStr(sharePermission);
const sharePermissionText = Utils.getShareLinkPermissionObject(sharePermissionStr).text;
window.seafile = { window.seafile = {
repoID, repoID,
docPath, docPath,
@@ -25,6 +32,8 @@ window.seafile = {
username, username,
avatarURL, avatarURL,
siteRoot, siteRoot,
sharePermissionText: sharePermissionText,
downloadURL: (canDownload && !trafficOverLimit) ? `?${zipped ? 'p=' + encodeURIComponent(docPath) + '&' : ''}dl=1` : '',
docPerm: filePerm, docPerm: filePerm,
historyURL: Utils.generateHistoryURL(siteRoot, repoID, docPath), historyURL: Utils.generateHistoryURL(siteRoot, repoID, docPath),
assetsUrl, assetsUrl,

View File

@@ -1,11 +1,11 @@
@font-face { @font-face {
font-family: "sdocfont"; /* Project id 4097705 */ font-family: "sdocfont"; /* Project id 4097705 */
src: url('./sdoc-editor-font/iconfont.eot?t=1692612471690'); /* IE9 */ src: url('./sdoc-editor-font/iconfont.eot?t=1693362307040'); /* IE9 */
src: url('./sdoc-editor-font/iconfont.eot?t=1692612471690#iefix') format('embedded-opentype'), /* IE6-IE8 */ src: url('./sdoc-editor-font/iconfont.eot?t=1693362307040#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('./sdoc-editor-font/iconfont.woff2?t=1692612471690') format('woff2'), url('./sdoc-editor-font/iconfont.woff2?t=1693362307040') format('woff2'),
url('./sdoc-editor-font/iconfont.woff?t=1692612471690') format('woff'), url('./sdoc-editor-font/iconfont.woff?t=1693362307040') format('woff'),
url('./sdoc-editor-font/iconfont.ttf?t=1692612471690') format('truetype'), url('./sdoc-editor-font/iconfont.ttf?t=1693362307040') format('truetype'),
url('./sdoc-editor-font/iconfont.svg?t=1692612471690#sdocfont') format('svg'); url('./sdoc-editor-font/iconfont.svg?t=1693362307040#sdocfont') format('svg');
} }
.sdocfont { .sdocfont {
@@ -16,6 +16,18 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.sdoc-download:before {
content: "\e652";
}
.sdoc-next-page:before {
content: "\e626";
}
.sdoc-previous-page:before {
content: "\e651";
}
.sdoc-save-tip:before { .sdoc-save-tip:before {
content: "\e650"; content: "\e650";
} }

View File

@@ -14,6 +14,12 @@
/> />
<missing-glyph /> <missing-glyph />
<glyph glyph-name="sdoc-download" unicode="&#58962;" d="M582.4 326.4V793.6c0 41.6-32 70.4-70.4 70.4s-70.4-28.8-70.4-70.4v-467.2l-172.8 172.8c-25.6 25.6-70.4 25.6-96-3.2-25.6-25.6-25.6-70.4 0-96l291.2-291.2c25.6-25.6 70.4-25.6 96 0l291.2 291.2c25.6 25.6 25.6 70.4 3.2 96-25.6 25.6-70.4 25.6-96 3.2l-3.2-3.2-172.8-169.6z m-480-284.8h822.4c38.4 0 70.4-28.8 70.4-70.4s-32-67.2-73.6-67.2H102.4C60.8-96 32-67.2 32-25.6c0 35.2 28.8 67.2 70.4 67.2z" horiz-adv-x="1024" />
<glyph glyph-name="sdoc-next-page" unicode="&#58918;" d="M342.4 768c12.8 0 28.8-6.4 38.4-16l329.6-329.6c22.4-22.4 22.4-57.6 0-76.8L380.8 16c-22.4-22.4-57.6-22.4-76.8 0-22.4 22.4-22.4 57.6 0 76.8L595.2 384 304 675.2c-22.4 22.4-22.4 57.6 0 76.8 9.6 9.6 25.6 16 38.4 16z" horiz-adv-x="1024" />
<glyph glyph-name="sdoc-previous-page" unicode="&#58961;" d="M672 768c-12.8 0-28.8-6.4-38.4-16L304 422.4c-22.4-22.4-22.4-57.6 0-76.8L633.6 16c22.4-22.4 57.6-22.4 76.8 0 22.4 22.4 22.4 57.6 0 76.8L419.2 384l291.2 291.2c22.4 22.4 22.4 57.6 0 76.8-9.6 9.6-25.6 16-38.4 16z" horiz-adv-x="1024" />
<glyph glyph-name="sdoc-save-tip" unicode="&#58960;" d="M528 800c153.6 0 272-112 284.8-252.8 121.6-9.6 208-137.6 208-291.2 0-160-86.4-284.8-201.6-288H208c-96 0-208 124.8-208 284.8s89.6 294.4 227.2 288c9.6 0 16 0 22.4-3.2C291.2 694.4 374.4 800 528 800z m3.2-96c-99.2 0-179.2-73.6-208-256-48 3.2-76.8 3.2-96 0-73.6-9.6-131.2-86.4-131.2-185.6S166.4 64 227.2 64h582.4c54.4 0 118.4 96 118.4 198.4 0 89.6-35.2 166.4-99.2 185.6-28.8 9.6-67.2 12.8-92.8 6.4-6.4 169.6-99.2 249.6-204.8 249.6z m163.2-252.8l38.4-41.6c6.4-6.4 6.4-16 0-22.4l-256-249.6c-12.8-12.8-32-16-44.8-3.2l-147.2 140.8c-6.4 6.4-6.4 12.8-3.2 19.2l3.2 3.2 38.4 38.4c6.4 6.4 16 6.4 22.4 0l108.8-105.6L672 448c6.4 9.6 16 9.6 22.4 3.2z" horiz-adv-x="1024" /> <glyph glyph-name="sdoc-save-tip" unicode="&#58960;" d="M528 800c153.6 0 272-112 284.8-252.8 121.6-9.6 208-137.6 208-291.2 0-160-86.4-284.8-201.6-288H208c-96 0-208 124.8-208 284.8s89.6 294.4 227.2 288c9.6 0 16 0 22.4-3.2C291.2 694.4 374.4 800 528 800z m3.2-96c-99.2 0-179.2-73.6-208-256-48 3.2-76.8 3.2-96 0-73.6-9.6-131.2-86.4-131.2-185.6S166.4 64 227.2 64h582.4c54.4 0 118.4 96 118.4 198.4 0 89.6-35.2 166.4-99.2 185.6-28.8 9.6-67.2 12.8-92.8 6.4-6.4 169.6-99.2 249.6-204.8 249.6z m163.2-252.8l38.4-41.6c6.4-6.4 6.4-16 0-22.4l-256-249.6c-12.8-12.8-32-16-44.8-3.2l-147.2 140.8c-6.4 6.4-6.4 12.8-3.2 19.2l3.2 3.2 38.4 38.4c6.4 6.4 16 6.4 22.4 0l108.8-105.6L672 448c6.4 9.6 16 9.6 22.4 3.2z" horiz-adv-x="1024" />
<glyph glyph-name="sdoc-file" unicode="&#58895;" d="M460.8 723.2H112c-16 0-35.2-12.8-35.2-35.2v-601.6c0-19.2 16-35.2 35.2-35.2h803.2c16 0 35.2 19.2 35.2 35.2V576c0 19.2-16 35.2-35.2 35.2H588.8c-12.8 0-16 6.4-22.4 12.8l-105.6 99.2z m137.6-38.4h313.6c57.6 0 112-48 112-115.2v-489.6c0-60.8-48-115.2-112-115.2h-800C51.2-32 0 16 0 83.2V684.8C0 745.6 48 800 112 800h361.6c12.8 0 16-6.4 22.4-12.8l102.4-102.4z" horiz-adv-x="1024" /> <glyph glyph-name="sdoc-file" unicode="&#58895;" d="M460.8 723.2H112c-16 0-35.2-12.8-35.2-35.2v-601.6c0-19.2 16-35.2 35.2-35.2h803.2c16 0 35.2 19.2 35.2 35.2V576c0 19.2-16 35.2-35.2 35.2H588.8c-12.8 0-16 6.4-22.4 12.8l-105.6 99.2z m137.6-38.4h313.6c57.6 0 112-48 112-115.2v-489.6c0-60.8-48-115.2-112-115.2h-800C51.2-32 0 16 0 83.2V684.8C0 745.6 48 800 112 800h361.6c12.8 0 16-6.4 22.4-12.8l102.4-102.4z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -70,6 +70,7 @@ body {
siteName: '{{ site_name }}', siteName: '{{ site_name }}',
enableWatermark: {% if enable_watermark %}true{% else %}false{% endif %}, enableWatermark: {% if enable_watermark %}true{% else %}false{% endif %},
canDownload: {% if permissions.can_download %}true{% else %}false{% endif %}, canDownload: {% if permissions.can_download %}true{% else %}false{% endif %},
canEdit: {% if permissions.can_edit %}true{% else %}false{% endif %},
fileContent: '{{ file_content|escapejs }}', fileContent: '{{ file_content|escapejs }}',
err: {% if err %}'{{ err }}'{% else %}''{% endif %}, err: {% if err %}'{{ err }}'{% else %}''{% endif %},
fileType: '{{ filetype }}', fileType: '{{ filetype }}',