cancel
Showing results for 
Search instead for 
Did you mean: 

Share Header customization and adding a new page

michaelp
Confirmed Champ
Confirmed Champ
Hello dear developers,

On the share header we want to remove and add elements. I removed the "My Files" element and added a "My Sites" element modifying share-header.lib.js. The new "My Sites" element should show the user all sites on which the user is a member. For this I copied the site-finder folder from site-webscripts/org/alfresco/components and renamed it to "my-sites" including all child files and the content of them (because I want the page to look exactly like the site-finder page but without the search elements). Then I removed the search text box and the button from the html.ftl file. The problem nos is that the new "page" Is not recognized from Share?!

Here some examples:

The json array for the shwown toolbar elements:
function generateAppItems() {
   var appItems = [
      {
         id: "HEADER_HOME",
         name: "alfresco/menus/AlfMenuBarItem",
         config: {
            id: "HEADER_HOME",
            label: "header.menu.home.label",
            targetUrl: "user/" + encodeURIComponent(user.name) + "/dashboard"
         }
      },
//      {
//         id: "HEADER_MY_FILES",
//         name: "alfresco/menus/AlfMenuBarItem",
//         config: {
//            id: "HEADER_MY_FILES",
//            label: "header.menu.myfiles.label",
//            targetUrl: "context/mine/myfiles"
//         }
//      },
      {
          id: "HEADER_MY_SITES",
          name: "alfresco/menus/AlfMenuBarItem",
          config: {
             id: "HEADER_MY_SITES",
             label: "My Sites",
             targetUrl: "my-sites"
          }
      },


And the "my-sites.get.desc.xml"
<webscript>
  <shortname>My Sites</shortname>
  <description>My Sites Toolbar Element</description>
  <url>/components/my-sites</url>
</webscript>


Everytime I click on the new "My Sites" element on the toolbar I get an error:

SEVERE: Servlet.service() for servlet [Spring Surf Dispatcher Servlet] in context with path [/share] threw exception [Could not resolve view with name 'my-sites' in servlet with name 'Spring Surf Dispatcher Servlet'] with root cause
javax.servlet.ServletException: Could not resolve view with name 'my-sites' in servlet with name 'Spring Surf Dispatcher Servlet'


Can anyone tell me what I am doing wrong? Or am I on the wrong way?

Many thanks for every answer!
1 REPLY 1

oleh
Champ in-the-making
Champ in-the-making
URLs for Aikau pages are a bit special.

The URL you define in the web script will be relative to /share/page/[hdp|dp]/ws/MY-URL

So for the page you defined there would be on /share/page/hdp/ws/components/my-sites or /share/page/dp/ws/components/my-sites to render without header/footer.

See my tutorial for more info: http://ohej.github.io/alfresco-tutorials/tutorial/aikau/tutorial.html#part-one-creating-a-page