I have registered javascript under portal_javascript using the answer 1 from How to Disable Copy Paste (Browser) steps I followed: 1> copied the script in a file
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")
Step 2)Selected portal_javascripts /added this script with just the same id/url under development mode and saved. 3.In the atreal.richfile.preview customize the template (atreal.richfile.preview.interfaces.ipreview-atreal.richfile.preview.viewlet) by setting the mouse buttons events onSelectStart and onSelectDrag to False. Change the code by removing the right top buttons of the preview window and also displaying files other than pdf in this window. Use the code block as :
<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>
- In ZMI, portal_types/File select Aliases tab and change the methods to (selected layout) for both Default and View Aliases and save.
- IN ZMI, portal_skins/archetypes customize at_download code to return nothing or rather deleted the code there.
- Use the add-on collective.documentviewer to preview pdf files. This works fine for me. I have been persueing this problem past 1 1/2 month. Finally I am happy with the end result. Thought of sharing with you all. :)