Goal
Disable upload of assets using Drag and Drop from Desktop to DAM Admin Console - http://localhost:4502/damadmin
For TouchUI check this post
Demo | Package Install
Solution
1) Login to CRXDE Lite (http://localhost:4502/crx/de) and create folder /apps/classicui-assets-disable-desktop-drop
2) Create node /apps/classicui-assets-disable-desktop-drop/clientlib of type cq:ClientLibraryFolder and add a String property categories with value cq.widgets
3) Create file (nt:file) /apps/classicui-assets-disable-desktop-drop/clientlib/js.txt and add
disable-drop.js
4) Create file (nt:file) /apps/classicui-assets-disable-desktop-drop/clientlib/disable-drop.js and add the following code.
(function () { if (window.location.pathname !== "/damadmin") { return; } //id set in /libs/wcm/core/content/damadmin var DAM_ADMIN_ID = "cq-damadmin"; function handleDrops() { var damAdmin = CQ.Ext.getCmp(DAM_ADMIN_ID); damAdmin.html5UploadFiles = function (files) { CQ.Ext.Msg.alert("Drop Error", "Drop from desktop disabled"); } } var INTERVAL = setInterval(function () { var grid = CQ.Ext.getCmp(DAM_ADMIN_ID + "-grid"); if (!grid) { return; } clearInterval(INTERVAL); try { handleDrops(); } catch (err) { console.log("error executing drag drop disable extension"); } }, 250); })();
Hi Sreekanth,
ReplyDeleteThanks for your blog. I am looking a way to disable drag and drop asset from Desktop to page directly. Any idea how to achieve this? Thanks in advance.