首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在办公时间禁用合流附件的下载

如何在办公时间禁用合流附件的下载
EN

Stack Overflow用户
提问于 2016-03-22 00:49:31
回答 1查看 365关注 0票数 0

汇合点 wiki有一个很好的方法来存储附件,可以将数百个文件上传到一个页面。每个页面就像一个文件夹,其中的页面内容和附件在文件夹中。附件可以通过转到Tools >附件并选择要下载的文件来下载。为了使事情变得更简单,可以选择下载所有的。这会将所有文件压缩起来,并将其发送给将其视为具有随机名称的.zip的用户。

用户在工作时间内下载的带有大量附件的页面存在问题,导致服务器负载过重。需要一种方法,用于在办公时间期间禁用下载功能或禁用在办公时间期间创建的大型压缩文件。

EN

回答 1

Stack Overflow用户

发布于 2016-03-22 00:53:22

编辑confluence/confluence/pages/viewattachments.vm并更改显示下载所有链接的逻辑,以便它只在购物时间之外显示。

添加代码:

代码语言:javascript
复制
        ## Only display Download All link during business hours ##
        #set ($tdate = $action.dateFormatter.getCurrentDateTime() ) ## Get todays date
        #set ($thour = $tdate.replaceAll(".* ([0-9]+):..", "$1") )  ## Extract the current hour value from the datetime string
        #if (!$thour.matches("8|9|10|11|12|13|14"))
            #if ($action.latestVersionsOfAttachments.size() > 1)
                <a id="download-all-link" href="$req.contextPath/pages/downloadallattachments.action?pageId=$pageId" title="$action.getText('download.all.desc')">$action.getText('download.all')</a>
            #end
        #else
            Download all attachments option only available outside of business hours.
        #end  ## $thour.matched end

这是要更改的代码块:

代码语言:javascript
复制
    #if ($latestVersionsOfAttachments.size() > 0)
        #set ($contextPath = "$req.contextPath/pages/viewpageattachments.action?pageId=$pageId&sortBy=$sortBy&")
        #set ($sortPathPrefixHtml = "?pageId=$page.id&sortBy=")
        #set ($showActions = "true")
        #set ($old = "true")
        #set ($attachmentHelper = $action)
        #parse("/pages/includes/attachments-table.vm")
        #if ($action.latestVersionsOfAttachments.size() > 1)
             <a id="download-all-link" href="$req.contextPath/pages/downloadallattachments.action?pageId=$pageId" title="$action.getText('download.all.desc')">$action.getText('download.all')</a>
        #end
        #pagination($action.paginationSupport $contextPath)
    #else
        $action.getText('currently.no.attachments')
    #end

以下是更改,以便只在办公时间以外显示下载所有链接:

代码语言:javascript
复制
    #if ($latestVersionsOfAttachments.size() > 0)
        #set ($contextPath = "$req.contextPath/pages/viewpageattachments.action?pageId=$pageId&sortBy=$sortBy&")
        #set ($sortPathPrefixHtml = "?pageId=$page.id&sortBy=")
        #set ($showActions = "true")
        #set ($old = "true")
        #set ($attachmentHelper = $action)
        #parse("/pages/includes/attachments-table.vm")
        ## Only display Download All link during business hours ##
        #set ($tdate = $action.dateFormatter.getCurrentDateTime() ) ## Get todays date
        #set ($thour = $tdate.replaceAll(".* ([0-9]+):..", "$1") )  ## Extract the current hour value from the datetime string
        #if (!$thour.matches("8|9|10|11|12|13|14"))
            #if ($action.latestVersionsOfAttachments.size() > 1)
                <a id="download-all-link" href="$req.contextPath/pages/downloadallattachments.action?pageId=$pageId" title="$action.getText('download.all.desc')">$action.getText('download.all')</a>
            #end
        #else
            Download all attachments option only available outside of business hours.
        #end  ## $thour.matched end
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36144336

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档