赞
踩
两种思路:
在confluence上面的工具栏,点击【设置】-【General Configuration】-【Custom HTML】-"At end of the BODY"添加的代码如下:
<script type="text/javascript"> $(document).ready(function(){ $('body').bind("DOMNodeInserted",function(e){ if(AJS.params.spaceKey=="**") // **表示空间标识 { if(AJS.params.canRemovePage==false) //当用户没有删除页面的权限时 { $('.cp-control-panel-download').hide(); //隐藏可以预览的附件(word或pdf)下载按钮 $('.cp-button').hide(); //隐藏不能预览的附件(压缩文件或者其他不支持预览的)下载按钮 $(".filename").attr("disabled",true).css("pointer-events","none"); //把文件列表模式下的附件设置为灰色 $('head').append('<style> @media print{html, body{display:none} } </style> ');//禁用页面打印 $('body').attr('oncontextmenu','self.event.returnValue=false'); //禁用右键菜单 $('body').attr('onselectstart','return false'); //禁用选中文字 } } }) AJS.toInit(function(){ if(AJS.params.spaceKey=="**") { if(AJS.params.canRemovePage==false) { AJS.$('#action-export-word-link').hide(); //隐藏导出为word按钮 AJS.$('#action-export-pdf-link').hide(); //隐藏导出为pdf按钮 AJS.$('#view-attachments-link').hide(); //隐藏附件按钮 $('head').append('<style> @media print{html, body{display:none} } </style> ');//禁用页面打印 $('body').attr('oncontextmenu','self.event.returnValue=false'); //禁用右键菜单 $('body').attr('onselectstart','return false'); //禁用选中文字 } } });}) </script>
Space Tools–Look and feel–Layout–Content Layouts—Page Layout
<style type="text/css">
.cp-control-panel-download {
display:none !important;
}
.cp-waiting-message-download {
display:none !important;
}
a.download-all-link {
display: none !important;
}
a#download-all-link {
display: none !important;
}
</style>
Space Tools–Look and feel–Layout–Content Layouts—Main Layout
#if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name)) #else <script type="text/javascript"> AJS.toInit(function(){ AJS.$('#view-attachments-link').hide(); AJS.$('#view-in-hierarchy-link').hide(); AJS.$('#content-metadata-attachments').hide(); }); </script> #end #if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name)) #else <script type="text/javascript"> AJS.toInit(function(){ AJS.$('#space-tools-menu-trigger').hide(); }); </script> #end
Space Tools–Look and feel–Layout–Content Layouts—Page Layout
<script type="application/javascript">
content_dom = document.getElementsByClassName("confluence-embedded-file");
for (var i = 0; i < content_dom.length; i++) {
content_dom[i].oncontextmenu = function () {
return false;
}
}
a_dom = document.querySelectorAll('a[data-linked-resource-type="attachment"]')
for (var i = 0; i < a_dom.length; i++) {
a_dom[i].oncontextmenu = function () {
return false;
}
}
</script>
Space Tools–Look and feel–Layout–Content Layouts—Page Layout
<style type="text/css" media="print">
body { visibility: hidden; display: none }
</style>
修改 listattachmentsforspace.vm
文件,参考Disable attachments for a whole Space
修改 attachments-table.vm
文件,参考Disable attachments for a specific page
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。