cancel
Showing results for 
Search instead for 
Did you mean: 

User language info - KM navigation IView

Former Member
0 Kudos

Hi All,

I'm trying to write a custom navigation iview that shows an URL depending of the userlanguage.

I wrote my custom WdfProxy, but I don't succeed in retrieving the userlanguage. With a normal iview you can retrieve the user info from the componentrequest, but the WdfProxy has not got such an attribute.

In the wdfproxy I try to ask userinfo via the iresource -

IResource startResource = ResourceFactory.getInstance().getResource(this.startUri,super.resourceContext);

- but startResource is null. I execute this code inside the getInternalParameters() method.

Can some tell me how I can retrieve the userlanguage?

We are running EP6 SP2.

Thanks

Message was edited by: Geert Wouters

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Detlev,

Thanks for the advise.

I was able to create a MyCustomWdfProxy object that does what it should do. There is however something wrong with the MyCustomNavigation.xml file.

When I load the navigationscreen, i see the correct link structure (the line at the top of the panel with the directory path/URL),but I don't see the directory content (detailed content panel).

If I replace the original WdfProxy code by my code, everything works fine.

Is there somewhere a parameter in the MyCustomNavigation.xml file that I should change in order to retrieve also the detailednavigation panel on my screen?

Thanks in advance

Message was edited by: Geert Wouters

detlev_beutner
Active Contributor
0 Kudos

Dag Geert,

maybe I was not clear enough, sorry. I didn't mean to rebuild the WDFProxy class but just to write a little wrapper calling the original com.sap.km.cm.Navigation iView with the standard parameter set. So you don't have to care about your own [...]Navigation.xml file.

Just a short extract:

protected void doOnNodeReady(IPortalComponentRequest req, IEvent event) {
  IUserContext user = req.getUser();
  String usersLang = null;
  Locale locale = user.getLocale();
  if (user.isMemberOfGroup("GRUP.SUPER_GROUPS_DATASOURCE.Anonymous Users", true) || locale == null) {
      usersLang = req.getServletRequest().getLocale().getLanguage();
  } else {
      usersLang = locale.getLanguage();
  }
  // build to be called URI like
  String uri = "/irj/servlet/prt/portal/prtroot/com.sap.km.cm.navigation";
  String path = "/documents/mylangs/lang_"  + usersLang;
  uri += path + "?path=" + path + "&StartUri=" + path +
    "&layoutSetMode=exclusive&XFProjectPath=" +
    &ConfigFileName=Navigation.xml&" +
    StartPage=NavigationPage&Validate=false&" +
    rndLayoutSet=NewsBrowser&rndRootLayoutSet=NewsBrowser";
  req.redirect(uri);
}

Of course you should do it generic and not hard code all the values given here but define them as properties, so that you can set them just as within the standard navigation iView and pass them through.

Hope it helps, groetjes

Detlev

Answers (1)

Answers (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Geert,

the better way to do so is to write your own proxy implementation as an AbstractPortalComponent; implement the user language request (and afterwards: the redirect to the standard KM component, with parameters set dynamically) within doOnNodeReady (doContent will be just an empty method).

This way you have killed two birds with one stone: Retrieving the user language works as usual and you are not modifying standard components, but just using them, making them dynamically.

Hope it helps

Detlev