我已经使用我遵循的如何禁用复制粘贴(浏览器)步骤中的答案 1 在 portal_javascript 下注册了 javascript :1> 将脚本复制到文件中
document.onkeydown = function(e) {
if (e.ctrlKey && e.keyCode === 65) {
// alert('not allowed');
return false;
}
if (e.ctrlKey && e.keyCode === 67) {
// alert('not allowed');
return false;
}
if (e.ctrlKey && e.keyCode === 86) {
// alert('not allowed');
return false;
}
};
document.oncontextmenu=new Function("return false")
步骤2)选择portal_javascripts /在开发模式下添加这个具有相同id / url的脚本并保存。3.在 atreal.richfile.preview 中自定义模板 (atreal.richfile.preview.interfaces.ipreview-atreal.richfile.preview.viewlet),将鼠标按钮事件 onSelectStart 和 onSelectDrag 设置为 False。通过删除预览窗口的右上角按钮并在此窗口中显示除 pdf 之外的文件来更改代码。将代码块用作:
<dl class="richfile portlet"
tal:condition="view/available"
tal:attributes="id view/plugin_id"
i18n:domain="atreal.richfile.preview">
<dt tal:attributes="id string:${view/plugin_id}Header" class="rfheader portletHeader">
<span class="portletTopLeft"></span>
<!--tal:block tal:replace="structure view/controls"-->
<span class="title" style="font-weight:bold"
i18n:translate="">
Preview
</span>
<span class="portletTopRight" ></span>
</dt>
<!--Your specific code here tal:condition="not:ispdf" -->
<dd>
<tal:block define="ispdf python:here.absolute_url().endswith('.pdf')">
<IFRAME src="http://www.xyz.com"
tal:condition="not:ispdf"
tal:attributes="src string:${here/absolute_url}/rfpreview"
width="100%" height="400" scrolling="auto" frameborder="1">
draggable="false" onselectstart="false"
</IFRAME>
</tal:block>
</dd>
</dl>
- 在 ZMI 中,portal_types/File 选择 Aliases 选项卡并将 Default 和 View Aliases 的方法更改为(选定布局)并保存。
- 在 ZMI 中,portal_skins/archetypes 自定义 at_download 代码以不返回任何内容,或者删除那里的代码。
- 使用附加组件collective.documentviewer 预览pdf 文件。这对我来说很好。在过去的 1 1/2 个月里,我一直在研究这个问题。最后,我对最终结果感到满意。想和大家分享一下。:)