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

ddraper
World-Class Innovator
World-Class Innovator

I'm a little bit confused by this question as it's not completely clear...

Is the button you're referring to the new new menu item that is added into the site pages menu bar (i.e. along with "Dashboard", "Document Library", etc). In this case you shouldn't be trying to change that menu item because the header component will be creating all of those links.

If you want to load a preference when you custom site page loads then you can do this in the WebScript controller that is generating the page (this would be the better way of doing it).

Maybe you could provide some more context as to what you're trying to do?

yes , new ("search") button added along with "Dashboard", "Document Library", etc site pages menu bar.

i am trying to change my new custom button, not the standard button

Also new button is related with URL  <page id="advanced-search"></page>

when i click on new button, URL of browser as follow. i can not set keyword into searchTerm=

share-config-custom.xml

<alfresco-config>
  <config evaluator="string-compare" condition="SitePages" replace="false">
    <pages>
      <page id="advanced-search">hdp/ws/components/advanced-search#scope=all_sites&amp;searchTerm=</page>    
    </pages>
  </config>
</alfresco-config>

ddraper
World-Class Innovator
World-Class Innovator

So there are two questions here I think...


Firstly you're saying that you cannot set the searchTerm keyword from the site page link? However, in the XML snippet you've shown you aren't actually providing a search term ! I'm assuming you've actually tried putting something after the = in the value of the page element?

Secondly it sounds like you're saying that the browser hash isn't being updated on search? Have you done any debugging to check whether or not the NavigationService code is being called? The navigateToPage function should be called as this will ultimately update the browser hash - I would recommend adding a break point in that function.

1) yes. i can not set keyword. i am trying to put keyword after 'searchTerm='

2) When i click on new button, i tried to update browser hash

yes. navigateToPage function is called. i debugged  it,  In 'data' parameter , url is same as

site/project-overview/hdp/ws/components/advanced-search#scope=all_sites&searchTerm=

ddraper
World-Class Innovator
World-Class Innovator

What is the data.type value? (in the debugger when you're clicking on your button)... is it "HASH"?

no it is "PAGE_RELATIVE"

ddraper
World-Class Innovator
World-Class Innovator

But it does have the hash value in? Because once again you've provided an example with no value for the searchTerm.

it does not have hash value.  i added following screenshot which has data of navigateToPage()

ddraper
World-Class Innovator
World-Class Innovator

Then I don't understand what the question is... you're not passing a value for the search term on the hash, so nothing is going to be set (either in the hash or in the search box).