cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Aikau Site Pages for Share

janaka1984
Star Contributor
Star Contributor

Hi,

i have followed this url (Creating Aikau Site Pages for Share | Alfresco Developer Blog ) to create Aikau Site Pages for Share (advanced search).  In share-confg-custom.xml file , i used "hdp/ws/components/advanced-search#scope=all_sites&searchTerm="

finally i can see button on header.

Problem is when i click on button i can not set keyword from preference and load result.

if i use following topic with parameter, it is properly update URL with keyword and load same data twice.

 this.alfPublish("ALF_NAVIGATE_TO_PAGE", {
                     url: ioQuery.objectToQuery(currHash),
                     type: "HASH"
                 }, true);

how to avoid this issue?

Regards

janaka

1 ACCEPTED ANSWER

janaka1984
Star Contributor
Star Contributor

Hi,

Instead of use share-config-custom.xml to create custom button which is working with parameter, on HEADER  TITLE , i have used controller JS to setup custom aikau button widget with existing HEADER TITLE .

Reference : Customizing the Share Header Menu 1 | Alfresco Developer Blog 

var titleMenu = widgetUtils.findObject(model.jsonModel, "id", "HEADER_TITLE_MENU");

var searchManagerUrl = "hdp/ws/components/com/search#scope=all_sites&searchTerm="+keyword;
if (page.url.templateArgs.site)
{
  searchManagerUrl = "site/" + page.url.templateArgs.site + "/" + searchManagerUrl;
}
var searchItem = {
      id: "SEARCH_CONFIG_PAGE_LINK",
      name: "alfresco/menus/AlfMenuBarItem",
      config: {
         label: msg.get("com-search-config.label"),
         title: msg.get("com-search.config.link"),
         targetUrl: searchManagerUrl
      }
   };

titleMenu.config.widgets.splice(0,0,searchItem);

Regards

janaka

View answer in original post

14 REPLIES 14

i override allWidgetsProcessed() of SingleTextFeildForm and publish following topic (ALF_NAVIGATE_TO_PAGE.).  but i can see same result twice.

var currHash = hashUtils.getHash();
 currHash.searchTerm = keyword;

 this.alfPublish("ALF_NAVIGATE_TO_PAGE", {
                    url: ioQuery.objectToQuery(currHash),
                    type: "HASH"
                }, true);

ddraper
World-Class Innovator
World-Class Innovator

OK... why are you overriding the allWidgetsProcessed function of SingleTextField form to do that? 

this function is used to check the initial state of the form.  then i use value of search field to assign into HASH, because search field widget is loaded first.

ddraper
World-Class Innovator
World-Class Innovator

OK... so then you must not be publishing a value for the hash to be set... rather than publishing with a type of "PAGE_RELATIVE", why not use a type of "HASH" instead and then the value of either an object with key/value pairs or a string.

janaka1984
Star Contributor
Star Contributor

Hi,

Instead of use share-config-custom.xml to create custom button which is working with parameter, on HEADER  TITLE , i have used controller JS to setup custom aikau button widget with existing HEADER TITLE .

Reference : Customizing the Share Header Menu 1 | Alfresco Developer Blog 

var titleMenu = widgetUtils.findObject(model.jsonModel, "id", "HEADER_TITLE_MENU");

var searchManagerUrl = "hdp/ws/components/com/search#scope=all_sites&searchTerm="+keyword;
if (page.url.templateArgs.site)
{
  searchManagerUrl = "site/" + page.url.templateArgs.site + "/" + searchManagerUrl;
}
var searchItem = {
      id: "SEARCH_CONFIG_PAGE_LINK",
      name: "alfresco/menus/AlfMenuBarItem",
      config: {
         label: msg.get("com-search-config.label"),
         title: msg.get("com-search.config.link"),
         targetUrl: searchManagerUrl
      }
   };

titleMenu.config.widgets.splice(0,0,searchItem);

Regards

janaka