Expand my Community achievements bar.

SOLVED

Touchui default path for assetfilter_image_path

Avatar

Level 4

I'm new to TouchUI, and having trouble knowing how to customize the editor.html even after reading the doc page... https://docs.adobe.com/docs/en/aem/6-1/develop/extending/customizing-page-authoring-touch.html

The goal of the customization is to load the dam images from the appropriate folder based on the "site" loaded. I have done this in ClassicUI some time ago, but am struggling with TouchUI.  I am tempted to try the 1:1 overlay of this structure, but that seems wrong given resource merger in AEM6.1. To be clear I do not want to change the search root, since the users should be able to select other paths. I would like to set a default path.

http://localhost:4502/crx/de/index.jsp#/libs/wcm/core/content/editor/jcr%3Acontent/sidepanels/edit/i...

I have a clientlib overlay of the ImageAssetPanel.js. I can see it is getting called by reviewing the JS console and outputting a log messages. The problem is that I don't know what is calling setSearchPath("") function on the initial page load. 

/* * ADOBE CONFIDENTIAL * * Copyright 2015 Adobe Systems Incorporated * All Rights Reserved. * * NOTICE:  All information contained herein is, and remains * the property of Adobe Systems Incorporated and its suppliers, * if any.  The intellectual and technical concepts contained * herein are proprietary to Adobe Systems Incorporated and its * suppliers and may be covered by U.S. and Foreign Patents, * patents in process, and are protected by trade secret or copyright law. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from Adobe Systems Incorporated. */ ; (function ($, ns, channel, window, undefined) { var contentPath = Granite.author.ContentFrame.location; var deptcode = contentPath.split("/")[3]; console.log("hello "+deptcode); var self = {}, name = 'Images'; // make the loadAssets fuction more flexible self.searchRoot = '/content/dam'; // "/bin/wcm/contentfinder/asset/view.json/content/dam/" + matches[2`] + "-assets"; // self.setSearchPath(self.searchRoot+"/"+deptcode+"-assets"); var searchPath = self.searchRoot+"/"+deptcode+"-assets", imageServlet = '/bin/wcm/contentfinder/asset/view.html', itemResourceType = 'cq/gui/components/authoring/assetfinder/asset', searchPath2 = self.searchRoot+"/"+deptcode+"-assets"; /** Pre asset type switch hook */ self.setUp = function () {}; /** Post asset type switch hook */ self.tearDown = function () {}; /** * * @param query {String} search query * @param lowerLimit {Number} lower bound for paging * @param upperLimit {Number} upper bound for paging * @returns {jQuery.Promise} */ self.loadAssets = function (query, lowerLimit, upperLimit) { var param = { '_dc': new Date().getTime(),  // cache killer 'query': query.concat("order:\"-jcr:content/jcr:lastModified\" "), // sort by jcr:content/jcr:lastModified property 'mimeType': 'image,application/x-ImageSet,application/x-SpinSet,application/x-MixedMediaSet', 'itemResourceType': itemResourceType, // single item rendering (cards) 'limit': lowerLimit + ".." + upperLimit, '_charset_': 'utf-8' }; console.log(searchPath); console.log(searchPath2); return $.ajax({ type: 'GET', dataType: 'html', url: Granite.HTTP.externalize(imageServlet) + searchPath, data: param }); }; /** * Set URL to image servlet * @param servlet {String} URL to image servlet */ self.setServlet = function (imgServlet) { imageServlet = imgServlet; }; self.setSearchPath = function (spath) { console.log("set sp to "+ spath); searchPath = spath; }; self.setItemResourceType = function (rt) { itemResourceType = rt; }; self.resetSearchPath = function () { searchPath = self.searchRoot; }; // register as a asset tab ns.ui.assetFinder.register(name, self); }(jQuery, Granite.author, jQuery(document), this));
1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

The setSearchPath function is called by the /libs/cq/gui/components/authoring/clientlibs/editor/js/ui/ui.assetFinder.js file at the following line-

if (typeof self.registry[currentController].setSearchPath === 'function') { self.registry[currentController].setSearchPath($currPathBrowserInput.val()); }

View solution in original post

2 Replies

Avatar

Level 4

I'm not seeing activity on this here. I'll try posting http://stackoverflow.com/questions/35466385/setting-default-path-for-asset-finder. Feel free to post either place. Thanks

Avatar

Correct answer by
Employee Advisor

The setSearchPath function is called by the /libs/cq/gui/components/authoring/clientlibs/editor/js/ui/ui.assetFinder.js file at the following line-

if (typeof self.registry[currentController].setSearchPath === 'function') { self.registry[currentController].setSearchPath($currPathBrowserInput.val()); }