Topic
  • 2 replies
  • Latest Post - ‏2013-03-27T14:09:36Z by SystemAdmin
SystemAdmin
SystemAdmin
445 Posts

Pinned topic [ICN 2.0.1] - Javascript to embed Navigator and connect to specific Desktop

‏2013-03-21T14:47:28Z |
Hello,
I am trying to develop a custom jsp page that must receive the username as a parameter, and use it to silently authenticate the user on ICN, then displaying a specific desktop that is not the default one.
I have taken parts of the native "launch.jsp" page, and followed the example described in the Redbook "Customizing and extending IBM Content Navigator".
My jsp page correctly authenticates the user, thus skipping the login dialog, but then loads the default desktop, regardless of the fact that my javascript code below tells it to load the non-default desktop.

This is the jsp I coded:


<%@ page language=
"java" contentType=
"text/html; charset=UTF-8" session=
"false" pageEncoding=
"UTF-8" import=
""%> <% response.setCharacterEncoding(
"UTF-8"); String htmlLocale = request.getLocale().toString().toLowerCase().replace(
'_',
'-'); htmlLocale = htmlLocale.replace(
"iw", 
"he");  
// workaround for Java getLocale() spec. %> <html lang=
"<%=htmlLocale%>"> <head> <title>Esselunga Content Navigator</title>   <%@ include file=
"header.jsp" %>   <script> dojo.registerModulePath(
"ecm", 
"<%=request.getContextPath()%>/ecm"); dojo.registerModulePath(
"idx", 
"<%=request.getContextPath()%>/idx");   dojo.require(
"ecm.model.Desktop"); dojo.require(
"ecm.model.Repository"); dojo.require(
"ecm.widget.dialog.LoginDialog"); dojo.require(
"ecm.Logger");   </script> </head>   <body class=
"<%=bodyClasses%>"> <div dojoType=
"ecm.widget.DesktopPane" id=
"ECMWebUI" style=
"width: 100%; height: 100%" dir=
"<%=direction%>" lang=
"<%=htmlLocale%>"></div>   <script> 
// Set up an error dialog and start monitoring for errors added to the desktop var errorDialog = 

new ecm.widget.dialog.ErrorDialog(); dojo.connect(ecm.model.desktop, 
"onMessageAdded", errorDialog, 
"messageAddedHandler");   
// Create and register the status dialog to appear during long running tasks var statusDialog = 

new ecm.widget.dialog.StatusDialog(); dojo.connect(ecm.model.desktop, 
"onRequestStarted", statusDialog, 
"requestStartedHandler"); dojo.connect(ecm.model.desktop, 
"onRequestCompleted", statusDialog, 
"requestCompletedHandler");   
// Create and register the (re)login dialog var loginDialog = ecm.widget.dialog.LoginDialog.getLoginDialog(); dojo.connect(ecm.model.desktop, 
"onSessionExpired", loginDialog, 
"sessionExpiredHandler"); 
// Load the desktop ecm.model.desktop.loadDesktop(
"MyNonDefaultDesktop", function() 
{ var repository = ecm.model.desktop.getRepository(
"MyRepository"); 

if (!repository.isConnected()) 
{ repository.setUserId(
"userid"); repository.logon(
"password",null,
"MyNonDefaultDesktop", 

true); 
} 
}, 

true); </script> </body> </html>


Am I doing something obviously wrong here?

Thanks in advance for your help!

Alessandro
Updated on 2013-03-27T14:09:36Z at 2013-03-27T14:09:36Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    445 Posts

    Re: [ICN 2.0.1] - Javascript to embed Navigator and connect to specific Desktop

    ‏2013-03-21T17:56:11Z  
    The problem is that the desktop is getting loaded by ecm.widget.DesktopPane. DesktopPane will load the default desktop if it does not not find a request parameter called "desktop" Hence, try to invoke your custom page as follows http://localhost/navigator?desktop=MyNonDefaultDesktop
  • SystemAdmin
    SystemAdmin
    445 Posts

    Re: [ICN 2.0.1] - Javascript to embed Navigator and connect to specific Desktop

    ‏2013-03-27T14:09:36Z  
    The problem is that the desktop is getting loaded by ecm.widget.DesktopPane. DesktopPane will load the default desktop if it does not not find a request parameter called "desktop" Hence, try to invoke your custom page as follows http://localhost/navigator?desktop=MyNonDefaultDesktop
    Thank you very much, I tried that and the desktop parameter gets read correctly...
    However, I don't understand what the use of the desktop parameter is in the ecm.model.desktop.loadDesktop and repository.logon methods.

    You mention the fact that this happens because I am using ecm.widget.DesktopPane to load the desktop... Is there another, better, way?