Hitachi Vantara Pentaho Community Forums
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: configurar pantallas de ingreso por cliente

  1. #1

    Default configurar pantallas de ingreso por cliente

    Estimados, necesito mostrar una página específica segun el cliente en el momento posterior al ingreso. Nosé si alguien me podria orientar en como hacer esto. Gracias!

  2. #2
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    Si te referís a la pantalla que por defecto tiene los íconos grandes, en la parte principal de la consola de usuario, podés hacerlo simplemente editando el archivo "biserver-ce/tomcat/webapps/pentaho/mantle/launch/launch.jsp".

    Añadiendo las clases "org.springframework.security.context.SecurityContextHolder" y "org.springframework.security.userdetails.User" (cuidado que por alguna razón me están apareciendo espacios que no deberían estar allí) al atributo "import" de ese JSP, luego podrás obtener el nombre del usuario registrado y sus roles con este código:

    Code:
    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    out.println("Username: " + user.getUsername());
    out.println("Roles:");
    for (Object o : user.getAuthorities()){
        out.println(o.toString());
    }
    En realidad no sólo al nombre de usuario y los roles: tendrás disponibles todos los métodos de esta clase. Si todos sirven en el caso de Pentaho, no estoy seguro.

    A partir de ahí hacer una personalización para cada usuario es una cuestión de creatividad.

    ¡Saludos!
    Last edited by tdidomenico; 05-19-2010 at 04:39 PM.
    (en) Path to Pentaho knowledge: (1:Search the Wiki > 2:Search the Forums > 3:Ask) or (1:Get a Subscription)
    (es) El camino al conocimiento en Pentaho: (1:Buscar en la Wiki > 2:Buscar en los Foros > 3:Preguntar) o (1:Comprar una Subscripción)

  3. #3

    Default

    si, justamente me referia a launch.jsp.
    y sabes la forma de obtener el rol en vez del usuario?
    tienes algun ejemplo. o sabes donde puedo encontrar uno? me seria de mucha utilidad

  4. #4
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    Edité mi respuesta original en este hilo para incluir esa información.

    ¡Saludos!
    Last edited by tdidomenico; 05-19-2010 at 04:41 PM.
    (en) Path to Pentaho knowledge: (1:Search the Wiki > 2:Search the Forums > 3:Ask) or (1:Get a Subscription)
    (es) El camino al conocimiento en Pentaho: (1:Buscar en la Wiki > 2:Buscar en los Foros > 3:Preguntar) o (1:Comprar una Subscripción)

  5. #5

    Default

    gracias por tu respuesta. sabes lo intente pero me tira errores de compilacion.

    Este es el launch.jsp modificado:

    Code:
    <%@ taglib prefix='c' uri='http://java.sun.com/jstl/core'%><%@ 
        page 
      language="java" 
      import="java.io.InputStream, 
          java.util.Locale, 
          java.util.PropertyResourceBundle, 
          java.util.ResourceBundle, 
          java.util.regex.Pattern, 
          java.util.regex.Matcher, 
          org.pentaho.platform.util.messages.LocaleHelper, 
          org.pentaho.platform.api.engine.IPentahoSession, 
          org.pentaho.platform.api.engine.IPluginManager, 
          org.pentaho.platform.api.repository.ISolutionRepository, 
          org.pentaho.platform.engine.core.system.PentahoSystem, 
          org.pentaho.platform.engine.core.system.StandaloneSession, 
          org.pentaho.platform.util.logging.Logger, 
          org.pentaho.platform.web.jsp.messages.Messages, 
          org.pentaho.platform.web.http.PentahoHttpSessionHelper, 
          org.apache.commons.lang.StringEscapeUtils,
          org.springframework.security.userdetails,
          org.springframework.security.context.SecurityContextHolder"%> 
    <% 
      /* 
       * Copyright 2006 Pentaho Corporation.  All rights reserved. 
       * This software was developed by Pentaho Corporation and is provided under the terms 
       * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
       * this file except in compliance with the license. If you need a copy of the license, 
       * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
       * BI Platform.  The Initial Developer is Pentaho Corporation. 
       * 
       * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
       * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
       * the license for the specific language governing your rights and limitations. 
       * 
       * @created Jul 23, 2005 
       * @author James Dixon 
       * 
       */ 
    %> 
     
    <%@page import="org.pentaho.ui.xul.XulOverlay"%> 
    <%@page import="org.pentaho.platform.api.engine.IPluginManager"%><html> 
    <head> 
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> 
     
     
    <title><%=Messages.getString("UI.PUC.LAUNCH.TITLE")%></title> 
     
    <style type="text/css"> 
    <!-- 
    body { 
      color: #000000; 
      background-color: #FFFFFF; 
      margin: 0px; 
    } 
     
    p { 
      margin: 0px; 
      padding: 0px; 
    } 
     
    A:link,A:visited,A:hover { 
      color: #7e932f; 
      text-decoration: underline; 
    } 
     
    A:hover { 
      color: #ca6333; 
      text-decoration: underline; 
    } 
     
    .launchPanel { 
      background-color: white; 
      background-image: url(images/quicklaunch_bg.png); 
      background-repeat: no-repeat; 
      background-position: center; 
      height: 100%; 
    } 
     
    .ql_container { 
      width: 620px; 
      margin-bottom: 50px; 
    } 
     
    .ql_icon_bar_left { 
      width: 41px; 
      height: 147px; 
      vertical-align: top; 
      padding-top: 25px; 
    } 
     
    .ql_icon_bar_middle { 
      background-image: 
        url(images/ql_icon_bar_middle.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      height: 199px; 
    } 
     
    .ql_icon_bar_right { 
      width: 41px; 
      height: 147px; 
      vertical-align: top; 
      padding-top: 25px; 
    } 
     
    .ql_spacer { 
      width: 20px; 
    } 
     
    .ql_btn { 
      width: 167px; 
    } 
     
    .ql_btn_left { 
      width: 41px; 
      height: 56px; 
    } 
     
    .ql_btn_middle { 
      background-image: url(images/ql_btn_middle.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
      font-size: 1.25em; 
      line-height: 20px; 
      font-weight: 300; 
      text-align: center; 
      vertical-align: top; 
      white-space: nowrap; 
      padding-top: 5px; 
    } 
     
    .ql_btn_right { 
      width: 41px; 
      height: 56px; 
    } 
     
    .ql_btn_left_hover { 
      width: 41px; 
      height: 56px; 
    } 
     
    .ql_btn_middle_hover { 
      background-image: 
        url(images/ql_btn_middle_hover.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
      font-size: 1.25em; 
      line-height: 20px; 
      font-weight: 300; 
      text-align: center; 
      vertical-align: top; 
      white-space: nowrap; 
      padding-top: 5px; 
    } 
     
    .ql_btn_right_hover { 
      width: 41px; 
      height: 56px; 
    } 
     
    .ql_new_report { 
      width: 120px; 
      height: 130px; 
      padding-bottom: 13px; 
      cursor: pointer; 
    } 
     
    .ql_new_analysis { 
      width: 120px; 
      height: 130px; 
      padding-bottom: 13px; 
      cursor: pointer; 
    } 
     
    .ql_manage { 
      width: 120px; 
      height: 130px; 
      padding-bottom: 13px; 
      cursor: pointer; 
    } 
     
    .ql_logo { 
      width: 290px; 
      height: 91px; 
      padding-bottom: 30px; 
    } 
     
    .button { 
      cursor: pointer; 
      width: 167px; 
      padding: 0px; 
      spacing: 0px; 
      height: 56px; 
    } 
     
    .btn_left { 
      background-image: url("images/ql_btn_left.png"); 
      background-repeat: no-repeat; 
      height: 56px; 
      width: 22px; 
    } 
     
    .btn_right { 
      background-image: url("images/ql_btn_right.png"); 
      background-repeat: no-repeat; 
      height: 56px; 
      width: 22px; 
    } 
     
    .btn_center { 
      background-image: url(images/ql_btn_middle.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
      font-size: 1.25em; 
      line-height: 20px; 
      font-weight: 300; 
      text-align: center; 
      vertical-align: top; 
      white-space: nowrap; 
      padding-top: 5px; 
    } 
     
    .btn_left_hover { 
      background-image: 
        url("images/ql_btn_left_hover.png"); 
      background-repeat: no-repeat; 
      height: 56px; 
      width: 22px; 
    } 
     
    .btn_right_hover { 
      background-image: 
        url("images/ql_btn_right_hover.png"); 
      background-repeat: no-repeat; 
      height: 56px; 
      width: 22px; 
    } 
     
    .btn_center_hover { 
      background-image: 
        url(images/ql_btn_middle_hover.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
      font-size: 1.25em; 
      line-height: 20px; 
      font-weight: 300; 
      text-align: center; 
      vertical-align: top; 
      white-space: nowrap; 
      padding-top: 5px; 
    } 
    --> 
    </style> 
     
    <script type="text/javascript"> 
    Button = function(label, container){ 
     
        var btn = document.createElement("input"); 
        btn.setAttribute("type","button"); 
     
     
        table = document.createElement("table"); 
        document.getElementById(container).innerHTML=""; 
        document.getElementById(container).appendChild(table); 
         
        table.setAttribute("cellpadding","0"); 
        table.setAttribute("cellspacing","0"); 
        table.setAttribute("border","0"); 
        table.className="button"; 
        table.setAttribute("height","56"); 
        table.setAttribute("width","167"); 
        table.cellSpacing = "0px"; 
        table.cellPadding = "0px"; 
     
        var tbody = document.createElement("tbody"); 
         
        var tr = document.createElement("tr"); 
     
        var left_td = document.createElement("td"); 
        left_td.className="btn_left"; 
        left_td.innerHTML = "<img src='images/ql_spacer.png'/ width='22' height='1'/><br/>"; 
        tr.appendChild(left_td); 
     
        var center_td = document.createElement("td"); 
        center_td.setAttribute("width","100%"); 
        center_td.className="btn_center"; 
        center_td.onselectstart=function(){return false;} 
        center_td.style.MozUserSelect='none'; 
        center_td.innerHTML = label; 
        tr.appendChild(center_td); 
     
        var right_td = document.createElement("td"); 
        right_td.innerHTML = "<img src='images/ql_spacer.png'/ width='22' height='1'/><br/>"; 
        right_td.className="btn_right"; 
        tr.appendChild(right_td); 
        tbody.appendChild(tr); 
         
        table.appendChild(tbody); 
     
        table.onmouseover=function(){ 
          window.selectedButton = this; 
          left_td.className="btn_left_hover"; 
          right_td.className="btn_right_hover"; 
          center_td.className="btn_center_hover"; 
        }; 
        this.reset = function(){ 
          left_td.className="btn_left"; 
          right_td.className="btn_right"; 
          center_td.className="btn_center"; 
        } 
         
        table.onmouseout = this.reset; 
         
        this.onClick=function(onClick){ 
          if(window.parent && window.parent.mantle_initialized){ 
            table.onclick = function(){eval("window.parent." + onClick)}; 
          } 
        }; 
    } 
     
    window.onresize = function(){ 
      if(window.selectedButton){ 
         window.selectedButton.onmouseout(); 
      } 
       
         
      // IE_6_FIX: When resized by PUC, IE will display rendering issues. This is accounted for by the code below.  
      if(window.isIE6){ 
         
        // IE6 has a rate limit on the number of resize events that it will fire. This means we cannot rely on the 
        // resize event alone to determine when the reisize is complete. The timer ensures that the layout is 
        // recomputed after PUC is done resizing the iframe. 
        setTimeout(function(){ 
          window.tableWrapperDiv.style.top = "1px"; 
          window.tableWrapperDiv.style.top = "0px"; 
        }, 350); 
         
      } 
     
    } 
     
    function loader(){ 
       
      // IE_6_FIX: We're using a CSS filter to enable transparany in IE 6. This has the side-effect of trapping mouse events in the 
      // filtered area. The standard workaround is to wrap that area in two divs, one absolutely positioned inside a relative one. 
     
      var navAgent = window.navigator.userAgent; 
      window.isIE6 = false; 
      var reg = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})").exec(navAgent) 
      if (reg != null) { 
        var version = parseFloat( RegExp.$1 ); 
        window.isIE6 = version >= 6.0 && version < 7.0; 
      } 
     
      // The following wrapps the button table with two DIVs, one positioned relative and the other absolute. 
      if(window.isIE6){ 
        var buttonTable = document.getElementById("buttonTable"); 
        var parent = buttonTable.parentNode; 
        window.tableWrapperDiv = document.createElement("div"); 
        var absDiv = document.createElement("div"); 
         
        with(tableWrapperDiv.style){ 
          position = "relative"; 
          width = "100%"; 
          height = "100%"; 
        } 
        with(absDiv.style){ 
          position = "absolute"; 
          top = "0px"; 
          left = "0px"; 
        } 
         
        parent.removeChild(buttonTable); 
        parent.appendChild(tableWrapperDiv); 
        tableWrapperDiv.appendChild(absDiv); 
        absDiv.appendChild(buttonTable); 
        tableWrapperDiv.id = "buttonWrapperDiv"; 
      } 
      // End IE_6_FIX 
       
        new Button("<%=Messages.getString( "UI.PUC.LAUNCH.NEW_REPORT" )%>", "launch_new_report").onClick("openWAQR()"); 
        new Button("<%=Messages.getString( "UI.PUC.LAUNCH.NEW_ANALYSIS" )%>", "launch_new_analysis").onClick("openAnalysis()"); 
    <%! 
      private static ResourceBundle getBundle(String messageUri) { 
        Locale locale = LocaleHelper.getLocale(); 
        IPentahoSession session = new StandaloneSession( "dashboards messages" ); //$NON-NLS-1$ 
        try { 
            if (messageUri.startsWith("content/")) { 
              messageUri = "system/" + messageUri.substring(8); //$NON-NLS-1$ 
            } 
          InputStream in = PentahoSystem.get(ISolutionRepository.class, session).getResourceInputStream(messageUri, true, ISolutionRepository.ACTION_EXECUTE); 
          return new PropertyResourceBundle( in ); 
        } catch (Exception e) { 
          Logger.error( Messages.class.getName(), "Could not get localization bundle", e ); //$NON-NLS-1$ 
        } 
        return null; 
      } 
    %><%  
      boolean pluginButton = false; 
      String buttonLabel = ""; 
      String buttonCommand = ""; 
      String buttonImage = ""; 
      IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, PentahoHttpSessionHelper.getPentahoSession(request)); //$NON-NLS-1$ 
        if (pluginManager != null) { 
            for(XulOverlay overlayObj : pluginManager.getOverlays()) { 
              if (overlayObj.getId() != null && overlayObj.getId().equals("launch")) { 
          ResourceBundle bundle = getBundle(overlayObj.getResourceBundleUri()); 
            // replace I18N parameters 
            Pattern p = Pattern.compile("\\$\\{([^\\}]*)\\}"); 
            Matcher m = p.matcher(overlayObj.getOverlayXml()); 
            StringBuffer sb = new StringBuffer(); 
            while (m.find()) { 
              String param = m.group(1); 
              m.appendReplacement(sb, bundle.getString(param)); 
            } 
            m.appendTail(sb); 
            String overlay = sb.toString(); 
           
          if (overlay.indexOf("id=\"manage_content\"") >= 0) { 
            int startButtonLabel = overlay.indexOf("label=\""); 
            int endButtonLabel = overlay.indexOf("\"", startButtonLabel + 7); 
            buttonLabel = overlay.substring(startButtonLabel + 7, endButtonLabel); 
             
            int startButtonImage = overlay.indexOf("image=\""); 
            int endButtonImage = overlay.indexOf("\"", startButtonImage + 7); 
            buttonImage = overlay.substring(startButtonImage + 7, endButtonImage); 
       
            int startButtonCommand = overlay.indexOf("command=\""); 
            int endButtonCommand = overlay.indexOf("\"", startButtonCommand + 9); 
            buttonCommand = overlay.substring(startButtonCommand + 9, endButtonCommand); 
            pluginButton = true; 
            break; 
          } 
              } 
          } 
        } 
      if (pluginButton) { 
    %>    new Button("<%=buttonLabel%>", "manage_content").onClick("<%= buttonCommand%>"); 
    <% 
      } else { 
    %>    new Button("<%=Messages.getString( "UI.PUC.LAUNCH.MANAGE_CONTENT" )%>", "manage_content").onClick("openManage()"); 
    <%  }  %> 
        fixPNGs(); 
    } 
     
    </script> 
      <script type="text/javascript" src="../pngfix.js"></script> 
      <script type="text/javascript"> 
          PngFix.spacerURL = "images/ql_spacer.png"; 
      </script> 
    </head> 
     
    <body>
    <%
    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    out.println("Username: ");
    out.println("Roles:");
    for (Object o : user.getAuthorities()){
        out.println(o.toString());
    }
    %>
    
    <h1>Steel Wheels Launch pad</h1>
    <p>Maybe one of these reports/analysis/dashboards can help you:</p>
    <ul>
      <li><a href="http://localhost:8080/pentaho/ViewAction?&solution=steel-wheels&path=charts&action=areachart_data.xaction">Area Chart Example</a></li>
      <li><a href="http://localhost:8080/pentaho/ViewAction?&solution=steel-wheels&path=analysis&action=analysis_customers.analysisview.xaction">Marketing Analysis by Year</a></li>
    </ul>
    </body>
    
     
     
     
    </html>
    y este es el error:
    Code:
    Estado HTTP 500 - 
    
    type Informe de Excepción
    mensaje 
    descripción El servidor encontró un error interno () que hizo que no pudiera rellenar este requerimiento.
    excepción 
    org.apache.jasper.JasperException: No se puede compilar la clase para JSP: 
    
    
    An error occurred at line: 22 in the generated java file
    Only a type can be imported. org.springframework.security.userdetails resolves to a package
    
    Ha tenido lugar un error en la línea: 460 en el archivo jsp: /mantle/launch/launch.jsp
    User cannot be resolved to a type
    457: 
    458: <body>
    459: <%
    460: User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    461: out.println("Username: ");
    462: out.println("Roles:");
    463: for (Object o : user.getAuthorities()){
    
    
    Ha tenido lugar un error en la línea: 460 en el archivo jsp: /mantle/launch/launch.jsp
    User cannot be resolved to a type
    457: 
    458: <body>
    459: <%
    460: User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    461: out.println("Username: ");
    462: out.println("Roles:");
    463: for (Object o : user.getAuthorities()){
    
    
    Stacktrace:
        org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
        org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
        org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
    OJALA ME PUEDAS AYUDAR..! GRACIAS!
    Last edited by tdidomenico; 05-26-2010 at 01:26 PM. Reason: Añadiendo tags de código para mejorar la legibilidad

  6. #6
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    Una de las librerías es "org.springframework.security.userdetails.User", no " org.springframework.security.userdetails", y la otra tiene un espacio en el medio que no corresponde ("...Conte xt...").

    ¡Saludos!
    (en) Path to Pentaho knowledge: (1:Search the Wiki > 2:Search the Forums > 3:Ask) or (1:Get a Subscription)
    (es) El camino al conocimiento en Pentaho: (1:Buscar en la Wiki > 2:Buscar en los Foros > 3:Preguntar) o (1:Comprar una Subscripción)

  7. #7

    Default

    Estimados, lo logré:

    este es mi launch.jsp modificado
    Code:
    <%@ taglib prefix='c' uri='http://java.sun.com/jstl/core'%><%@ 
        page 
      language="java" 
      import="java.io.InputStream, 
          java.util.Locale, 
          java.util.PropertyResourceBundle, 
          java.util.ResourceBundle, 
          java.util.regex.Pattern, 
          java.util.regex.Matcher, 
          org.pentaho.platform.util.messages.LocaleHelper, 
          org.pentaho.platform.api.engine.IPentahoSession, 
          org.pentaho.platform.api.engine.IPluginManager, 
          org.pentaho.platform.api.repository.ISolutionRepository, 
          org.pentaho.platform.engine.core.system.PentahoSystem, 
          org.pentaho.platform.engine.core.system.StandaloneSession, 
          org.pentaho.platform.util.logging.Logger, 
          org.pentaho.platform.web.jsp.messages.Messages, 
          org.pentaho.platform.web.http.PentahoHttpSessionHelper, 
          org.apache.commons.lang.StringEscapeUtils,
          org.springframework.security.userdetails.User,
          org.springframework.security.context.SecurityContextHolder"%> 
    <% 
      /* 
       * Copyright 2006 Pentaho Corporation.  All rights reserved. 
       * This software was developed by Pentaho Corporation and is provided under the terms 
       * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
       * this file except in compliance with the license. If you need a copy of the license, 
       * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
       * BI Platform.  The Initial Developer is Pentaho Corporation. 
       * 
       * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
       * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
       * the license for the specific language governing your rights and limitations. 
       * 
       * @created Jul 23, 2005 
       * @author James Dixon 
       * 
       */ 
    %> 
     
    <%@page import="org.pentaho.ui.xul.XulOverlay"%> 
    <%@page import="org.pentaho.platform.api.engine.IPluginManager"%><html> 
    <head> 
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> 
     
     
    <title><%=Messages.getString("UI.PUC.LAUNCH.TITLE")%></title> 
     
    <style type="text/css"> 
    <!-- 
    body { 
      color: #000000; 
      background-color: #FFFFFF; 
      margin: 0px; 
    } 
     
    p { 
      margin: 0px; 
      padding: 0px; 
    } 
     
    A:link,A:visited,A:hover { 
      color: #7e932f; 
      text-decoration: underline; 
    } 
     
    A:hover { 
      color: #ca6333; 
      text-decoration: underline; 
    } 
     
    .launchPanel { 
      background-color: white; 
      background-image: url(images/quicklaunch_bg.png); 
      background-repeat: no-repeat; 
      background-position: center; 
      height: 100%; 
    } 
     
    .ql_container { 
      width: 620px; 
      margin-bottom: 50px; 
    } 
     
    .ql_icon_bar_left { 
      width: 41px; 
      height: 147px; 
      vertical-align: top; 
      padding-top: 25px; 
    } 
     
    .ql_icon_bar_middle { 
      background-image: 
        url(images/ql_icon_bar_middle.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      height: 199px; 
    } 
     
    .ql_icon_bar_right { 
      width: 41px; 
      height: 147px; 
      vertical-align: top; 
      padding-top: 25px; 
    } 
     
    .ql_spacer { 
      width: 20px; 
    } 
     
    .ql_btn { 
      width: 167px; 
    } 
     
    .ql_btn_left { 
      width: 41px; 
      height: 56px; 
    } 
     
    .ql_btn_middle { 
      background-image: url(images/ql_btn_middle.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
      font-size: 1.25em; 
      line-height: 20px; 
      font-weight: 300; 
      text-align: center; 
      vertical-align: top; 
      white-space: nowrap; 
      padding-top: 5px; 
    } 
     
    .ql_btn_right { 
      width: 41px; 
      height: 56px; 
    } 
     
    .ql_btn_left_hover { 
      width: 41px; 
      height: 56px; 
    } 
     
    .ql_btn_middle_hover { 
      background-image: 
        url(images/ql_btn_middle_hover.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
      font-size: 1.25em; 
      line-height: 20px; 
      font-weight: 300; 
      text-align: center; 
      vertical-align: top; 
      white-space: nowrap; 
      padding-top: 5px; 
    } 
     
    .ql_btn_right_hover { 
      width: 41px; 
      height: 56px; 
    } 
     
    .ql_new_report { 
      width: 120px; 
      height: 130px; 
      padding-bottom: 13px; 
      cursor: pointer; 
    } 
     
    .ql_new_analysis { 
      width: 120px; 
      height: 130px; 
      padding-bottom: 13px; 
      cursor: pointer; 
    } 
     
    .ql_manage { 
      width: 120px; 
      height: 130px; 
      padding-bottom: 13px; 
      cursor: pointer; 
    } 
     
    .ql_logo { 
      width: 290px; 
      height: 91px; 
      padding-bottom: 30px; 
    } 
     
    .button { 
      cursor: pointer; 
      width: 167px; 
      padding: 0px; 
      spacing: 0px; 
      height: 56px; 
    } 
     
    .btn_left { 
      background-image: url("images/ql_btn_left.png"); 
      background-repeat: no-repeat; 
      height: 56px; 
      width: 22px; 
    } 
     
    .btn_right { 
      background-image: url("images/ql_btn_right.png"); 
      background-repeat: no-repeat; 
      height: 56px; 
      width: 22px; 
    } 
     
    .btn_center { 
      background-image: url(images/ql_btn_middle.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
      font-size: 1.25em; 
      line-height: 20px; 
      font-weight: 300; 
      text-align: center; 
      vertical-align: top; 
      white-space: nowrap; 
      padding-top: 5px; 
    } 
     
    .btn_left_hover { 
      background-image: 
        url("images/ql_btn_left_hover.png"); 
      background-repeat: no-repeat; 
      height: 56px; 
      width: 22px; 
    } 
     
    .btn_right_hover { 
      background-image: 
        url("images/ql_btn_right_hover.png"); 
      background-repeat: no-repeat; 
      height: 56px; 
      width: 22px; 
    } 
     
    .btn_center_hover { 
      background-image: 
        url(images/ql_btn_middle_hover.png); 
      background-repeat: repeat-x; 
      width: 100%; 
      font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; 
      font-size: 1.25em; 
      line-height: 20px; 
      font-weight: 300; 
      text-align: center; 
      vertical-align: top; 
      white-space: nowrap; 
      padding-top: 5px; 
    } 
    --> 
    </style> 
     
    <script type="text/javascript"> 
    Button = function(label, container){ 
     
        var btn = document.createElement("input"); 
        btn.setAttribute("type","button"); 
     
     
        table = document.createElement("table"); 
        document.getElementById(container).innerHTML=""; 
        document.getElementById(container).appendChild(table); 
         
        table.setAttribute("cellpadding","0"); 
        table.setAttribute("cellspacing","0"); 
        table.setAttribute("border","0"); 
        table.className="button"; 
        table.setAttribute("height","56"); 
        table.setAttribute("width","167"); 
        table.cellSpacing = "0px"; 
        table.cellPadding = "0px"; 
     
        var tbody = document.createElement("tbody"); 
         
        var tr = document.createElement("tr"); 
     
        var left_td = document.createElement("td"); 
        left_td.className="btn_left"; 
        left_td.innerHTML = "<img src='images/ql_spacer.png'/ width='22' height='1'/><br/>"; 
        tr.appendChild(left_td); 
     
        var center_td = document.createElement("td"); 
        center_td.setAttribute("width","100%"); 
        center_td.className="btn_center"; 
        center_td.onselectstart=function(){return false;} 
        center_td.style.MozUserSelect='none'; 
        center_td.innerHTML = label; 
        tr.appendChild(center_td); 
     
        var right_td = document.createElement("td"); 
        right_td.innerHTML = "<img src='images/ql_spacer.png'/ width='22' height='1'/><br/>"; 
        right_td.className="btn_right"; 
        tr.appendChild(right_td); 
        tbody.appendChild(tr); 
         
        table.appendChild(tbody); 
     
        table.onmouseover=function(){ 
          window.selectedButton = this; 
          left_td.className="btn_left_hover"; 
          right_td.className="btn_right_hover"; 
          center_td.className="btn_center_hover"; 
        }; 
        this.reset = function(){ 
          left_td.className="btn_left"; 
          right_td.className="btn_right"; 
          center_td.className="btn_center"; 
        } 
         
        table.onmouseout = this.reset; 
         
        this.onClick=function(onClick){ 
          if(window.parent && window.parent.mantle_initialized){ 
            table.onclick = function(){eval("window.parent." + onClick)}; 
          } 
        }; 
    } 
     
    window.onresize = function(){ 
      if(window.selectedButton){ 
         window.selectedButton.onmouseout(); 
      } 
       
         
      // IE_6_FIX: When resized by PUC, IE will display rendering issues. This is accounted for by the code below.  
      if(window.isIE6){ 
         
        // IE6 has a rate limit on the number of resize events that it will fire. This means we cannot rely on the 
        // resize event alone to determine when the reisize is complete. The timer ensures that the layout is 
        // recomputed after PUC is done resizing the iframe. 
        setTimeout(function(){ 
          window.tableWrapperDiv.style.top = "1px"; 
          window.tableWrapperDiv.style.top = "0px"; 
        }, 350); 
         
      } 
     
    } 
     
    function loader(){ 
       
      // IE_6_FIX: We're using a CSS filter to enable transparany in IE 6. This has the side-effect of trapping mouse events in the 
      // filtered area. The standard workaround is to wrap that area in two divs, one absolutely positioned inside a relative one. 
     
      var navAgent = window.navigator.userAgent; 
      window.isIE6 = false; 
      var reg = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})").exec(navAgent) 
      if (reg != null) { 
        var version = parseFloat( RegExp.$1 ); 
        window.isIE6 = version >= 6.0 && version < 7.0; 
      } 
     
      // The following wrapps the button table with two DIVs, one positioned relative and the other absolute. 
      if(window.isIE6){ 
        var buttonTable = document.getElementById("buttonTable"); 
        var parent = buttonTable.parentNode; 
        window.tableWrapperDiv = document.createElement("div"); 
        var absDiv = document.createElement("div"); 
         
        with(tableWrapperDiv.style){ 
          position = "relative"; 
          width = "100%"; 
          height = "100%"; 
        } 
        with(absDiv.style){ 
          position = "absolute"; 
          top = "0px"; 
          left = "0px"; 
        } 
         
        parent.removeChild(buttonTable); 
        parent.appendChild(tableWrapperDiv); 
        tableWrapperDiv.appendChild(absDiv); 
        absDiv.appendChild(buttonTable); 
        tableWrapperDiv.id = "buttonWrapperDiv"; 
      } 
      // End IE_6_FIX 
       
        new Button("<%=Messages.getString( "UI.PUC.LAUNCH.NEW_REPORT" )%>", "launch_new_report").onClick("openWAQR()"); 
        new Button("<%=Messages.getString( "UI.PUC.LAUNCH.NEW_ANALYSIS" )%>", "launch_new_analysis").onClick("openAnalysis()"); 
    <%! 
      private static ResourceBundle getBundle(String messageUri) { 
        Locale locale = LocaleHelper.getLocale(); 
        IPentahoSession session = new StandaloneSession( "dashboards messages" ); //$NON-NLS-1$ 
        try { 
            if (messageUri.startsWith("content/")) { 
              messageUri = "system/" + messageUri.substring(8); //$NON-NLS-1$ 
            } 
          InputStream in = PentahoSystem.get(ISolutionRepository.class, session).getResourceInputStream(messageUri, true, ISolutionRepository.ACTION_EXECUTE); 
          return new PropertyResourceBundle( in ); 
        } catch (Exception e) { 
          Logger.error( Messages.class.getName(), "Could not get localization bundle", e ); //$NON-NLS-1$ 
        } 
        return null; 
      } 
    %><%  
      boolean pluginButton = false; 
      String buttonLabel = ""; 
      String buttonCommand = ""; 
      String buttonImage = ""; 
      IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, PentahoHttpSessionHelper.getPentahoSession(request)); //$NON-NLS-1$ 
        if (pluginManager != null) { 
            for(XulOverlay overlayObj : pluginManager.getOverlays()) { 
              if (overlayObj.getId() != null && overlayObj.getId().equals("launch")) { 
          ResourceBundle bundle = getBundle(overlayObj.getResourceBundleUri()); 
            // replace I18N parameters 
            Pattern p = Pattern.compile("\\$\\{([^\\}]*)\\}"); 
            Matcher m = p.matcher(overlayObj.getOverlayXml()); 
            StringBuffer sb = new StringBuffer(); 
            while (m.find()) { 
              String param = m.group(1); 
              m.appendReplacement(sb, bundle.getString(param)); 
            } 
            m.appendTail(sb); 
            String overlay = sb.toString(); 
           
          if (overlay.indexOf("id=\"manage_content\"") >= 0) { 
            int startButtonLabel = overlay.indexOf("label=\""); 
            int endButtonLabel = overlay.indexOf("\"", startButtonLabel + 7); 
            buttonLabel = overlay.substring(startButtonLabel + 7, endButtonLabel); 
             
            int startButtonImage = overlay.indexOf("image=\""); 
            int endButtonImage = overlay.indexOf("\"", startButtonImage + 7); 
            buttonImage = overlay.substring(startButtonImage + 7, endButtonImage); 
       
            int startButtonCommand = overlay.indexOf("command=\""); 
            int endButtonCommand = overlay.indexOf("\"", startButtonCommand + 9); 
            buttonCommand = overlay.substring(startButtonCommand + 9, endButtonCommand); 
            pluginButton = true; 
            break; 
          } 
              } 
          } 
        } 
      if (pluginButton) { 
    %>    new Button("<%=buttonLabel%>", "manage_content").onClick("<%= buttonCommand%>"); 
    <% 
      } else { 
    %>    new Button("<%=Messages.getString( "UI.PUC.LAUNCH.MANAGE_CONTENT" )%>", "manage_content").onClick("openManage()"); 
    <%  }  %> 
        fixPNGs(); 
    }
    <%
    User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    out.println("Username: " + user.getUsername());
    out.println("Roles:");
    for (Object o : user.getAuthorities()){
        out.println(o.toString());
    }
    %> 
     
    </script> 
      <script type="text/javascript" src="../pngfix.js"></script> 
      <script type="text/javascript"> 
          PngFix.spacerURL = "images/ql_spacer.png"; 
      </script> 
    </head> 
     
    <body>
    
    
    
    <% 
    
    String usuario=user.getUsername();
    //out.println("usuario: " + usuario);
    //Integer i=0;
    
    
    //-----------------------VEO ROLES PARA COMPARAR CON ROL DE INGRESO---------------
    String authenticated=new String("Authenticated");
    String admin=new String("Admin");
    String inmob_rol1=new String("rol1");
    String inmob_rol2=new String("rol2");
    
    //--------------------------------------------------------------
    for (Object o : user.getAuthorities()){
            String a= (String) o.toString();
        String[] arrayRol=a.split(" ");
        Integer b=arrayRol.length;
        
        if(a.equalsIgnoreCase(authenticated))
        {
        //out.println("SON IGUALES!!!");
        //ENTRA EN ROL = AUTHENTICATED, QUE TIENEN TODOS LOS USUARIOS
        }
        else
        {
        //out.println("SON DISTINTOS!!!");
        //out.println("ROL :|" + a+"|");
            if(a.equalsIgnoreCase(admin))
                    {
                    //out.println("es admin");
                    %>
                    <script>window.location="http://xx.xx.xx.xx:8080/pentaho/content/pentaho-cdf/RenderXCDF?solution=admin1&path=REPORTES/REPORTES&action=reportes.xcdf&template=mantle";</script>
                    <%
            }
            else if(a.equalsIgnoreCase(inmob_rol1))
                    {
                    //out.println("es rol1");
                    %>
                    <script>window.location="http://xx.xx.xx.xx:8080/pentaho/content/pentaho-cdf/RenderXCDF?solution=rol1&path=REPORTES/REPORTES&action=reportes.xcdf&template=mantle";</script>
                    <%
                    }
            else if(a.equalsIgnoreCase(inmob_rol2))
                    {
                    //out.println("es rol2");
                    %>
                    <script>window.location="http://xx.xx.xx.xx:8080/pentaho/content/pentaho-cdf/RenderXCDF?solution=rol2&path=REPORTES/REPORTES&action=reportes.xcdf&template=mantle";</script>
                    <%
                    }
        
        }
    }
    
    
    %>
    </ul>
    </body>
    
     
     
     
    </html>
    Last edited by tdidomenico; 05-26-2010 at 01:29 PM. Reason: Añadiendo tags de código para mejorar la legibilidad

  8. #8

    Default

    Hola que tal,

    Necesito hacer exactamente lo mismo que lograste, estoy usando parte de tu codigo , sin embargo no me funciona, no veo ningun cambio, ya reinicie el BIServer y todo parece igual, al logearme con diferentes usuarios con diferentes roles, siempre me manda al mismo lugar, tienes idea por que podría estar pasando esto? estoy usando la version comunitaria 3.6.0

    Muchas gracias

    Saludos !!

  9. #9

    Default

    lo que hice principalmente es este codigo que te comento:

    for (Object o : user.getAuthorities()){
    String a= (String) o.toString(); //asigno ROL A VARIABLE a tomando el valor de user.getAuthorities
    String[] arrayRol=a.split(" ");
    Integer b=arrayRol.length;
    //siempre toma 2 valores, el rol asginado en PAC previamente por ti y Authenticated, que da por default el sistema
    if(a.equalsIgnoreCase(authenticated))
    {
    //out.println("SON IGUALES!!!");
    //ENTRA EN ROL = AUTHENTICATED, QUE TIENEN TODOS LOS USUARIOS
    }
    else
    {
    //out.println("SON DISTINTOS!!!");
    //out.println("ROL :|" + a+"|");
    //COMPARA con el valor de rol que no es authenticated, osea el que
    //estoy buscando, y si es igual a admin en este caso con javascript redirijo a la direccion que yo quiera
    //en este caso a un template para cada rol
    if(a.equalsIgnoreCase(admin))
    {
    //out.println("es admin");
    %>
    <script>window.location="http://xx.xx.xx.xx:8080/pentaho/content/pentaho-cdf/RenderXCDF?solution=admin1&path=REPORTES/REPORTES&action=reportes.xcdf&template=mantle";</script>
    <%
    }

  10. #10

    Default

    Hola,

    Gracias por tu pronta respuesta, ya logré que funcionara, otra pregunta sabes cómo puedo hacer para que cuando el usuario sea Admin, sí muestre lo que traía por default, es decir los íconos grandes.

    Estoy siguiento este tutorial : http://www.prashantraju.com/2010/03/...onsole-part-3/ , y ya vi como customizar el user console, pero ahora quiero tener 2 diferentes versiones del user console , uno para el rol admin y otro para los demás roles.

    Gracias,

    Saludos!!
    Last edited by jegordon; 09-15-2010 at 01:30 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.