3

I've created a new page Aikau, but I changed the XML file and the rendered page content between the standard Share header and footer disappeared.

In this page, I want the arguments of the query string, so I write this code:

page.get.desc.xml:

<webscript>
    <shortname>My New Page</shortname>
    <url>/hdp/ws/my-new-page</url>
    <authentication>user</authentication>
</webscript>

page.get.js:

function main ()
{
    // Get the args
    var fileProp = args["test"];

    model.temp = fileProp;
}

main();

page.get.html.ftl:

Test arg: ${temp}

I have to put /hdp/ws/my-new-page in the XML file to write the content of FTL file in this page... But why did the header and footer of the Alfresco template disappeared ? hdp serves for this purpose. And if I don't put the URL like that on the XML, the page appears with the template.

What is wrong in my code? Or how can I recover the template? Or add header and footer?

EDIT: I already try to put only /my-new-page without /hdp/ws/ but the args are null when I put /hdp/ws/. Give me a hint.

EDIT2: I already try to import alfresco-template.ftl but I can't. Any idea?

Younes Regaieg
  • 4,156
  • 2
  • 21
  • 37
PRVS
  • 1,612
  • 4
  • 38
  • 75

2 Answers2

3

You don't actually need to include the the "hdp/ws" part in your WebScript descriptor. Only the "/my-new-page" is required. Aikau attempts to simplify the Surf page creation by providing a number of pages out-of-the-box (and the "hdp" page is just one of them).

Aikau uses URI-template mapping to match a single WebScript to a page, so for example in the URL:

/share/page/hdp/ws/my-new-page

share = application context page = Spring MVC request dispatcher

hdp/ws/my-new-page is then mapped to the URI template:

<uri-template id="share-page">/{pageid}/ws/{webscript}</uri-template>

Where "hdp" is the id of the page to render and "my-new-page" is the WebScript URL. The HDP page uses the "webscript" token from the template to automatically create a new Surf Component and bind it to the WebScript.

But in short - don't include "hdp/ws" in your WebScript URLs for Aikau pages.

Dave Draper
  • 1,837
  • 11
  • 25
1

You need to make the things that you have on javascript server in this javascript mandatorily? If not, you can create a javascript client that receive the same arguments (location.search give to you the query string, so, you can make parse of that query string and get only the value of the "test" that you want) and call them on FTL file (the client-side javascript). So, when the page loading, it does not lose the arguments. It isn't the best solution but you can try this...

JMR
  • 765
  • 1
  • 8
  • 31
  • Oh ! It works :) Same code but in the client side... For now, I can "live" with that solution ;) Thank you so much!! :) – PRVS Nov 09 '15 at 14:42