Multiple html files in your theme in combination with deeplink module (...)

4
Hi everybody! I have a portal where a few different user-groups can logon. So instead of only having the index.html, i have for example index-resellers.html It seemed to work nicely: the appropriate theming is visible for each of the html-files. However there is (at least) one "but". In my theme I use some quicklinks like "change login details". The links are created with use of the Deeplink module and there I have to configure the IndexPage constant (which has the value index.html). The problem now is: If I'm working in index-resellers.html and click on a deeplink, the system switches back to the theme that belongs to index.html Is there a (preferably simple) way to keep those quicklinks and to NOT have the issue that the theme is switched back? I'd like to hear what the options are!
asked
3 answers
4

The application page is determined at line 223 - 225 of javasource/deeplink/actions/StartDeeplink.java:

//finally, redirect
response.setStatus(IMxRuntimeResponse.SEE_OTHER);
response.addHeader("location", getRelPath(request) + String.valueOf(Core.getConfiguration().getConstantValue(INDEX_CONSTANT)));

So you could change the target html based on the deeplink's name, for example:

//finally, redirect
//default case
String targetIndex = String.valueOf(Core.getConfiguration().getConstantValue(INDEX_CONSTANT));
//exceptions
if ("green".equals(deeplink.getName()))
  targetIndex = "index-green.html";
else if ("blue".equals(deeplink.getName()))
  targetIndex = "thatblueindex.html"


response.setStatus(IMxRuntimeResponse.SEE_OTHER);
response.addHeader("location", getRelPath(request) + targetIndex);
answered
1

I think this is currently the way how the deeplink module works. So in order to achieve your goal, you should change the deeplink module.

answered
1

Thanks Michel, I checked this and got it working.

A question though: I have a few deeplinks that are shared across multiple "usergroups" / htmlpages in my theme.

Does that mean that for these deeplinks I have to create multiple deeplinks with different differing Deeplink.name (each using the same microflow for the form to open...) to be able to split on the targetIndex that I want to redirect to?

Please confirm (or correct me if I'm wrong). A nicer way would be that the browser "detects" which .html-file the system uses, and that this file is used as targetIndex to redirect to...

But... I'm not sure if this .html-filename the user currently browses in, can be 'detected'?

I'd like to hear. If "detecting" is not possible, I'm helped out with the other solution, so thanks anyway...

UPDATE on 31 august:

I got the "detect which html file I work with" mechanism working. For the interested: The relevant changes:

// default targetIndex
            String targetIndex = String.valueOf(Core.getConfiguration().getConstantValue(INDEX_CONSTANT));

            String referer = request.getHeader("Referer");
            String[] refererParts = referer.split("/");

            // (only) Change indexPage if the .html file is mentioned in the
            // referer (else: the default is taken)
            if (refererParts[refererParts.length - 1].contains(".html")) {
                targetIndex = refererParts[refererParts.length - 1];
            }

            // finally, redirect
answered