{"id":53871,"date":"2021-08-25T20:47:12","date_gmt":"2021-08-25T15:17:12","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=53871"},"modified":"2024-11-27T12:13:17","modified_gmt":"2024-11-27T06:43:17","slug":"sorting-preferences-list-of-dita-topics-in-aem-xml-web-editor-interface","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/sorting-preferences-list-of-dita-topics-in-aem-xml-web-editor-interface\/","title":{"rendered":"Sorting Preferences (List of DITA Topics) in AEM XML Web Editor Interface"},"content":{"rendered":"<h4><b>Problem statement<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">For editing the XML content AEM provides an XML web editor interface, where editors can edit content, add XML elements in the markup and refer one or more Darwin Information Typing Architecture(<\/span><a href=\"https:\/\/en.wikipedia.org\/wiki\/Darwin_Information_Typing_Architecture\"><span style=\"font-weight: 400;\">DITA<\/span><\/a><span style=\"font-weight: 400;\">) topics\/articles in a DITA topic. Editors can navigate the preferences list and include it in the DITA topic. The out of the box provided preference list is not in sorted order, so whenever an editor wants to include a specific topic in a DITA topic he\/she has to scroll down the list and find it. Since the list is not in sorted order, if the list is too huge it&#8217;s difficult for the editor to find it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To make the editor experience better there is a need to provide a Sorting option to the editor so that the required topic can be easily identified in the list.<\/span><\/p>\n<h4><b>Solution<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">You can customize the AEM XML Web editor interface for <\/span><a href=\"https:\/\/docs.oasis-open.org\/dita\/v1.2\/os\/spec\/archSpec\/definition-of-ditamaps.html\"><span style=\"font-weight: 400;\">DITA Map<\/span><\/a><span style=\"font-weight: 400;\"> and provide a sorting option to the editor. <\/span><span style=\"font-weight: 400;\">To achieve it the following steps need to be performed.<\/span><\/p>\n<h4><b>Interface Customization<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">1. Overlay the <\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/libs\/fmdita\/ditamapeditor\/core\/editor\/jcr:content\/body\/content\/header\/items\/selection\/items<\/span><br \/>\n<span style=\"font-weight: 400;\">to :- \/apps\/fmdita\/ditamapeditor\/core\/editor\/jcr:content\/body\/content\/header\/items\/selection\/items<\/span><\/p>\n<p><span style=\"font-weight: 400;\">and add toggleSort item (toggle button for Ascending, Descending) under it. By overlaying the node and adding the required items we can see this option on the AEM web interface.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-54356 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-01-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1252\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-01-scaled.jpg 2560w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-01-300x147.jpg 300w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-01-1024x501.jpg 1024w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-01-768x375.jpg 768w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-01-1536x751.jpg 1536w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-01-2048x1001.jpg 2048w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-01-624x305.jpg 624w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<h4><b>Persisting the Sorting Preference<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">2. On click of this custom button added, make an ajax call to servlet by passing the preference to be stored like ascending(a-z) or descending(z-a) as the value attached to the button. This will save the editors preference and when the editor accesses the interface next time, the selected preference will already be there.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">3. In the servlet, save this preference against any property (I have used \u2018sortBy\u2019) to some node, like<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/apps\/fmdita\/ditamapeditor\/core\/editor\/jcr:content\/body\/content\/aside\/items\/references\/layout\/layouts\/columns <\/span><span style=\"font-weight: 400;\">(overlayed node) OR to the editor profile.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-54358 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-02-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1252\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-02-scaled.jpg 2560w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-02-300x147.jpg 300w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-02-1024x501.jpg 1024w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-02-768x375.jpg 768w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-02-1536x751.jpg 1536w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-02-2048x1001.jpg 2048w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-02-624x305.jpg 624w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<h4><b>Sorting Logic<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">4. Overlay<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/libs\/fmdita\/components\/columnview\/columnview.jsp<br \/>\nto<br \/>\n\/apps\/fmdita\/components\/columnview\/columnview.jsp<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here the sorting of the references will be performed.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">4.1 Items at line no 33 need to be sorted. This is one of the custom sorting logic, one can have their own implementation for sorting.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ Sort the data, custom code<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-54359 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-03-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1252\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-03-scaled.jpg 2560w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-03-300x147.jpg 300w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-03-1024x501.jpg 1024w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-03-768x375.jpg 768w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-03-1536x751.jpg 1536w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-03-2048x1001.jpg 2048w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-03-624x305.jpg 624w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">4.2 Similarly the following method as shown in the snapshot should also return sorted result.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-54362 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-04-1-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1252\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-04-1-scaled.jpg 2560w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-04-1-300x147.jpg 300w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-04-1-1024x501.jpg 1024w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-04-1-768x375.jpg 768w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-04-1-1536x751.jpg 1536w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-04-1-2048x1001.jpg 2048w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-04-1-624x305.jpg 624w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<h4><b>Final Interface Snapshot<\/b><\/h4>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-54363 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-05-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1108\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-05-scaled.jpg 2560w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-05-300x130.jpg 300w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-05-1024x443.jpg 1024w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-05-768x332.jpg 768w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-05-1536x665.jpg 1536w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-05-2048x886.jpg 2048w, \/blog\/wp-ttn-blog\/uploads\/2021\/08\/Blog19-05-624x270.jpg 624w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">On clicking the ascending\/ descending button the preferences will be stored as explained in the previous steps. Here, we get the preference list in sorted order. Editor can easily look for the required item from the list and they will now have an option to toggle between ascending and descending.<\/span><\/p>\n<h4><b>References<\/b><\/h4>\n<ul>\n<li><span style=\"font-weight: 400;\">DITA maps:<br \/>\nDITA maps are documents that organize topics and other resources into structured collections of information. For detailed information please refer to the <\/span><a href=\"https:\/\/docs.oasis-open.org\/dita\/v1.2\/os\/spec\/archSpec\/definition-of-ditamaps.html\"><span style=\"font-weight: 400;\">document<\/span><\/a><\/li>\n<li><span style=\"font-weight: 400;\">XML Documentation Add-On for AEM:<br \/>\nThe Add-On provides the capability of managing content and publishing it from AEM. For detailed information please refer to the user guide section of this <\/span><a href=\"https:\/\/helpx.adobe.com\/in\/support\/xml-documentation-for-experience-manager.html\"><span style=\"font-weight: 400;\">document<\/span><\/a><\/li>\n<\/ul>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Problem statement For editing the XML content AEM provides an XML web editor interface, where editors can edit content, add XML elements in the markup and refer one or more Darwin Information Typing Architecture(DITA) topics\/articles in a DITA topic. Editors can navigate the preferences list and include it in the DITA topic. The out of [&hellip;]<\/p>\n","protected":false},"author":1357,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":35},"categories":[5868],"tags":[4847,4881,4878,505,4882],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/53871"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1357"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=53871"}],"version-history":[{"count":8,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/53871\/revisions"}],"predecessor-version":[{"id":54441,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/53871\/revisions\/54441"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=53871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=53871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=53871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}