Script piwik dans un .jsp


#1

Bonjour est-ce possible d’écrire le script piwik dans un .jsp
Je voudrais dans le jsp suivant mettre mon code pour soit remplacer l’ID user récupéré par piwik soit créer une variable personnalisée avec cet ID.


<%@ page import="com.jdedwards.webgui.*,com.jdedwards.services.login.*,com.jdedwards.services.login.display.*,java.util.*,com.jdedwards.portal.util.*" info="HTML4 Login Screen JSP for B9 Portal"  contentType="text/html; charset=UTF-8"%>
<jsp:useBean id="error" scope="request" class="com.jdedwards.services.login.LoginException"/>
<jsp:useBean id="returnUrl" scope="request" class="java.lang.String"/>
<%@taglib prefix="webgui"  uri="http://java.peoplesoft.com/e1/webgui"%>
<%@taglib prefix="maflet"  uri="http://java.peoplesoft.com/e1/maflet"%>
<%
boolean roleChooserOn = ((Boolean)request.getAttribute("roleChooserOn")).booleanValue();
boolean rememberMeChecked = ((Boolean)request.getAttribute("rememberMeChecked")).booleanValue();
boolean useRememberMe = ((Boolean)request.getAttribute("useRememberMe")).booleanValue();
boolean isPasswordAboutToExpire = ((Boolean)request.getAttribute("isPasswordAboutToExpire")).booleanValue();
boolean passwordChangeError = ((Boolean)request.getAttribute("passwordChangeError")).booleanValue();
boolean hasPasswordChangeOrAboutToExpireError = passwordChangeError || isPasswordAboutToExpire ;
boolean environmentModeHidden = (((Boolean)request.getAttribute("isEnvironmentHidden")).booleanValue() || hasPasswordChangeOrAboutToExpireError);
boolean environmentReadOnly = ((Boolean)request.getAttribute("isEnvironmentReadOnly")).booleanValue();
boolean rtlLayout = ((Boolean)request.getAttribute("rtlLayout")).booleanValue();
String daysTillPasswordExpiration = (String)request.getAttribute("daysTillPasswordExpiration");
String loginImage = (String) request.getAttribute("largeLoginImage");
Hashtable params = (Hashtable)request.getAttribute("params");
ResourceBundle resource = (ResourceBundle)request.getAttribute("resource");
UserInfo userInfo = (UserInfo)request.getAttribute("userInfo");
String defaultEnvironment = (String)request.getAttribute("defaultEnvironment");
boolean useCacheManager = ((Boolean)request.getAttribute("useCacheManager")).booleanValue();
if(defaultEnvironment == null){
	defaultEnvironment = "";
}
String defaultRole = (String)request.getAttribute("defaultRole");
if(defaultRole == null){
	defaultRole = "";
}
%>
<%!
boolean smallScreen = false;

// Change JAS.INI value [OWWEB] LargeLoginImage to change company logo

// JDE-specific String resources (see below for translation)
String legalInfoLabel = "tbd";
String legalInfoJavaScript = "tbd";
String copyrightText = "tbd";

com.peoplesoft.e1.container.MafletResourceUrlBuilder resourceUrlBuilder;
// modify this variable's value if you want to add your own company disclaimer text
String companyDisclaimerHTML = "This system is intended for limited (authorized) use and is subject to company policies.";
%>

<%
    resourceUrlBuilder = (com.peoplesoft.e1.container.MafletResourceUrlBuilder)request.getAttribute(com.peoplesoft.e1.container.MafletResourceUrlBuilder.MAFLET_RES_URL_ATTR);
%>
<maflet:resourceCanonicalsScriptTag />
<SCRIPT type=text/javascript language="JavaScript" src='<maflet:resourceUrl resource="/js/cacheManager.js"/>'></SCRIPT>
<script>

function processCache()
{
    // The following resources are for the E1 Menu which is the next page displayed after login.
    // Precache these resources now for performance reasons.
    // See cacheManager.js for a description of how cache is performed.
    
    window.cacheManager = new cacheManagerObject(_jdeMenuCachedResources); 
    window.cacheManager.startProcessPreLoad();
}
</script>

<%@ include file="loginDecoration.jspf" %>
<%
try
{
/*	com.jdedwards.webgui.GUIEnvironment loginPageGuiEnv =  com.jdedwards.webgui.taglib.TagLibUtil.getGUIEnvironment(pageContext);
	if (null != loginPageGuiEnv)
	{
		smallScreen = loginPageGuiEnv.isDeviceFeatureSupported(loginPageGuiEnv.DEVICE_SMALL_SCREEN);
	}*/
	legalInfoLabel = resource.getString("JH_LEGAL_90");
	legalInfoJavaScript = resource.getString("JH_LEGALINFOWEBJAVASCRIPT");
	copyrightText = resource.getString("JH_COPYRIGHT");
        companyDisclaimerHTML = resource.getString("JH_COMPANY_DISCLAIMER");
}
catch (Throwable t)
{
	copyrightText = t.getMessage(); // display the exception message
}

if (rtlLayout)
{
%><HTML lang="en-US" DIR=RTL><%
}
else
{%><HTML lang="en-US"><%
}%>

<HEAD>
<%--Make use not cache --%>
<meta http-equiv="PRAGMA" name="PRAGMA" content="NO-CACHE">
<meta http-equiv="Expires" name="Expires" content="Mon, 06 Jan 1990 00:00:01 GMT">

<script language="JavaScript1.2">

<%if(isPasswordAboutToExpire){%>
function doSubmitPWLater(){
 	var changepw = document.getElementById("<%=LoginDisplayManager.CHANGEPASSWORD%>");
 	changepw.value = "FALSE";
 	document.getElementById("F1").submit();
}
<%}%>

NumberOfLoginClicks = 0;
function isFirstClick() {
	NumberOfLoginClicks++;
	if(NumberOfLoginClicks>1) {return false;}
	return true;
}

function doClear()
{
	var jdeowpForm = document.getElementById("F1");
	jdeowpForm.reset(); // clears the change password fields if they are present
	var jdeowpUserID = document.getElementById("<%=LoginDisplayManager.USERID%>");
	jdeowpUserID.value = "";
	var jdeowpPassword = document.getElementById("<%=LoginDisplayManager.PASSWORD%>");
	jdeowpPassword.value = "";
<% if (!environmentModeHidden){%>	
	var jdeowpEnvironment = document.getElementById("<%=LoginDisplayManager.ENVIRONMENT%>");
	jdeowpEnvironment.value = "";
	var jdeowpRole = document.getElementById("<%=LoginDisplayManager.ROLE%>");
	jdeowpRole.value = "";
<%}%>	
}

function getCookie(cookiename)
{
	var arg = cookiename + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		{
			var endstr = document.cookie.indexOf (";", j);
			if (endstr == -1)
				endstr = document.cookie.length;
			return unescape(document.cookie.substring(j, endstr));
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	return "";
}

function setCookie(name,value,expires,path,domain,secure) 
{      
    document.cookie = name + "=" + value +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function onloadScripts()
{
<% if(!environmentModeHidden){%>	
	// set the appropriate advanced state
	if ("block" == getCookie("advancedState"))
	{
		toggleAdvanced();
		unhighlight();
	}
<%}%>	
	
<%
String name = "";
String environment = "";
String role = "";
if (userInfo != null)
{
	name = userInfo.getUserId();
	environment = userInfo.getEnvironment();
	role = userInfo.getRole();
	
}

// determine which field to initially select
if ( (null == error.getErrorMessage()) && (name.length() > 0) )
{
	// select the password field b/c there wasn't an error and the User ID field already has a value in it%>
	var fieldToSelect = document.getElementById("<%=LoginDisplayManager.PASSWORD%>");
<%
}
else
{
	// select the User ID field b/c there was an error or the User ID field is empty%>
	var fieldToSelect = document.getElementById("<%=LoginDisplayManager.USERID%>");
<%}%>	
	fieldToSelect.focus();
	fieldToSelect.select();
	
	<%=JSPUtilities.getBackbuttonProtectionInvoker()%>

    var returnArray = new Array();
    var l=0;
    var runAppCookie=getCookie("e1AppState");

    // check to see if child windows are open. If so...close them all.
    if (runAppCookie!=null)
    {
        var i=0;
        var j=0;
        var clen=runAppCookie.length;
        while (i < clen)
        {
            i = runAppCookie.indexOf("|", i)+1;
            if (i == 0) break;
            var singleEntry=runAppCookie.substring(j,i-1);
            j=i;
            var k=singleEntry.indexOf(":");
            var windowName = singleEntry.substring(k+1);
            returnArray[l++]=windowName;
        }

         var securityCheck = "";
         <% if(request.isSecure()) {%> securityCheck = true;<%}%>;

         window.setCookie("e1AppState", "", "", "/", "", securityCheck);

        for (var i=returnArray.length-1;i>=0;i--) 
        {
            if (returnArray[i].indexOf("E1MENUMAIN_") == -1)
            {
                var winToClose = window.open('', returnArray[i], 'height=1,width=1,top=0,left=5000,screenX=0,screenY=5000');
                if (winToClose && winToClose.jdeMenuParent)
                {
                    winToClose.handleOnBrowserClose(true, true);
                }
                else
                {
                    winToClose.close();
                }
            }
        }
    }
    
    // preload static content for the menu
    <% if(useCacheManager){ %>
    processCache();
    <% } %>
    }
</script>

<title><%=resource.getString("JH_LOGINTITLE")%></title>
<webgui:pagehead addtitle="false"/>

</HEAD>
<BODY onload="onloadScripts()" class="loginBodyAuto">
<div>
<%//Begin of SWAN style login screen%>
<%=renderStartingLoginDecoration(loginImage)%>
<table cellpadding=0 cellspacing=0 class="loginTable">
<tr><td class="loginTopSpace"></td></tr>
<tr><td class="loginMiddleSpace">
<table cellpadding=0 cellspacing=0 class="loginTable">
<tr><td class="loginTopLinesTD">&nbsp;</td>
<td class="loginPeopleBgTD">
<table cellpadding=0 cellspacing=0><tr><td class="loginPeopleTD"></td></tr></table>
</td></tr>
<tr class="loginGrayBg">
<td class="loginValignTop">
<table cellpadding=0 cellspacing=0>
<tr><td class="loginGlobalTopTD">&nbsp;</td></tr>
<tr><td class="loginGlobalTD">&nbsp;</td></tr>
</table>
</td>
<td class="loginValignTop">
<table class="loginLightBlueTable" cellpadding=0 cellspacing=0>
<tr><td class="loginValignTop">
<%//Begin of the error/warning message%>
<%if (error.getErrorMessage() != null)
{
%>
<table cellpadding=0 cellspacing=0 class="loginErrorMargin"><tr>
<%if(rtlLayout)
{%>
<td align="right">
<%
}
else
{%>
<td align="left">
<%}%>
<DIV CLASS="InYourFaceError littleprint loginErrorPadding">
<img src="<webgui:resourceUrl resourceUrl="images/error-small.gif"/>">
<b><%=resource.getString("JH_LOGINERROR")%>:&nbsp;</b>
  <%=error.getErrorMessage()%>
</DIV>
</td></tr></table>
<%
}
if(isPasswordAboutToExpire){%>
<table cellpadding=0 cellspacing=0 class="loginErrorMargin"><tr>
<%if(rtlLayout)
{%>
<td align="right">
<%
}
else
{%>
<td align="left">
<%}%>
<DIV CLASS="InYourFaceWarning littleprint loginErrorPadding">
<img src="<webgui:resourceUrl resourceUrl="images/warning-small.gif"/>"/>
<b><%=resource.getString("JH_LOGINWARNING")%>:&nbsp;</b>
  <%=Portal.replaceSubstring(resource.getString("JH_LOGIN_ERROR_15"), "%d", daysTillPasswordExpiration ).toString()%>
</DIV>
</td></tr></table>
<%}%>
<%//End of the error/warning message%>
</td></tr>
<tr><td>
<%//Begin of the login frame%>
<TABLE class="loginFrameTable loginFrameTableMargin" cellpadding=0 cellspacing=0><tr><td align="center">
<FORM class="FORM" NAME="F1" ID="F1" METHOD="POST" ACTION="<%=returnUrl%>">
<%=JSPUtilities.getBackbuttonProtectionHTML()%>
<%if(isPasswordAboutToExpire){%>
<INPUT TYPE=hidden NAME="<%=LoginDisplayManager.CHANGEPASSWORD%>" ID="<%=LoginDisplayManager.CHANGEPASSWORD%>" VALUE="<%=LoginDisplayManager.YES%>">
<%}%>
<TABLE>
<%if (error.getErrorMessage() != null)
{
%>
<TR><TD class="loginText" NOWRAP><LABEL><%=resource.getString("JH_USERID")%></LABEL><LABEL FOR="<%=LoginDisplayManager.USERID%>" class="accessibility"><%=resource.getString("JH_LOGINERROR")%>. <%=error.getErrorMessage()%> <%=resource.getString("JH_USERID")%></LABEL></TD><TD><INPUT SIZE=15 class="textfield" TYPE=text NAME="<%=LoginDisplayManager.USERID%>" ID="<%=LoginDisplayManager.USERID%>" VALUE="<%=name%>" <%=hasPasswordChangeOrAboutToExpireError?"readonly":""%> ></TD></TR>
<%
}
else
{%>
<TR><TD class="loginText" NOWRAP><LABEL FOR="<%=LoginDisplayManager.USERID%>"><%=resource.getString("JH_USERID")%></LABEL></TD><TD><INPUT SIZE=15 class="textfield" TYPE=text NAME="<%=LoginDisplayManager.USERID%>" ID="<%=LoginDisplayManager.USERID%>" VALUE="<%=name%>" <%=hasPasswordChangeOrAboutToExpireError?"readonly":""%> ></TD></TR>
<%}%>
<TR><TD class="loginText" NOWRAP><LABEL FOR="<%=LoginDisplayManager.PASSWORD%>"><%
if (hasPasswordChangeOrAboutToExpireError)
	out.print(resource.getString("JH_OLDPASSWORD"));
else
	out.print(resource.getString("JH_PASSWORD"));
%></LABEL></TD><TD><INPUT SIZE=15 maxlength="10" class="textfield" TYPE=password NAME="<%=LoginDisplayManager.PASSWORD%>" ID="<%=LoginDisplayManager.PASSWORD%>" VALUE=""></TD></TR>
<%if (hasPasswordChangeOrAboutToExpireError)
{%>
<TR><TD class="loginText" NOWRAP><LABEL FOR="<%=LoginDisplayManager.NEWPASSWORD%>"><%=resource.getString("JH_NEWPASSWORD")%></LABEL></TD><TD><INPUT SIZE=15 maxlength="10" class="textfield" TYPE=password NAME="<%=LoginDisplayManager.NEWPASSWORD%>" VALUE=""></TD></TR>
<TR><TD class="loginText" NOWRAP><LABEL FOR="<%=LoginDisplayManager.CONFIRMPASSWORD%>"><%=resource.getString("JH_CONFIRMPASSWORD")%></LABEL></TD><TD><INPUT SIZE=15 maxlength="10" class="textfield" TYPE=password NAME="<%=LoginDisplayManager.CONFIRMPASSWORD%>" VALUE=""></TD></TR>
<INPUT TYPE=hidden NAME="<%=LoginDisplayManager.ENVIRONMENT%>" ID="<%=LoginDisplayManager.ENVIRONMENT%>" VALUE="<%=environment%>">
<INPUT TYPE=hidden NAME="<%=LoginDisplayManager.ROLE%>" ID="<%=LoginDisplayManager.ROLE%>" VALUE="<%=role%>">
<%}
else
{%>

<% if(!environmentModeHidden){%>
<script language=JavaScript1.2>
var advancedState = "none";
var idleUpImage = new Image();
var selectedUpImage = new Image();
var idleDownImage = new Image();
var selectedDownImage = new Image();
idleUpImage.src = "<webgui:resourceUrl resourceUrl="images/toggle_up.gif"/>";
selectedUpImage.src = "<webgui:resourceUrl resourceUrl="images/toggle_up_sel.gif"/>";
idleDownImage.src = "<webgui:resourceUrl resourceUrl="images/toggle_down.gif"/>";
selectedDownImage.src = "<webgui:resourceUrl resourceUrl="images/toggle_down_sel.gif"/>";

function highlight()
{
	var jdeowpAdvancedImg = document.getElementById("ADVANCED_IMG");
	if (advancedState == "none")
		jdeowpAdvancedImg.src = selectedDownImage.src;

	else
		jdeowpAdvancedImg.src = selectedUpImage.src;
		

}

function unhighlight()
{
	var jdeowpAdvancedImg = document.getElementById("ADVANCED_IMG");
	if (advancedState == "none")
		jdeowpAdvancedImg.src = idleDownImage.src;

	else
		jdeowpAdvancedImg.src = idleUpImage.src;
		
}

function toggleAdvanced()
{
	var jdeowpAdvancedEnv1 = document.getElementById("ADVANCED_ENV1");
	var jdeowpAdvancedEnv2 = document.getElementById("ADVANCED_ENV2");
<%if (roleChooserOn)
{%>
	var jdeowpAdvancedRole1 = document.getElementById("ADVANCED_ROLE1");
	var jdeowpAdvancedRole2 = document.getElementById("ADVANCED_ROLE2");
<%}%>
	var jdeowpAdvancedCheckbox = document.getElementById("ADVANCED_CHECKBOX");
	if (advancedState == "none")
		advancedState = "block";
	else
		advancedState = "none";
	jdeowpAdvancedEnv1.style.display = advancedState;
	jdeowpAdvancedEnv2.style.display = advancedState;
<%if (roleChooserOn)
{%>
	jdeowpAdvancedRole1.style.display = advancedState;
	jdeowpAdvancedRole2.style.display = advancedState;
<%}%>

	highlight();
	
	// remember the state in a cookie
	var expire = new Date();
	expire.setTime(expire.getTime() + ( 7*24*60*60*1000 ) ); // expire in 1 week
	document.cookie = "advancedState=" + advancedState + "; expires=" + expire.toGMTString();
}

</script>

<%}//End is EnvModeHidden%>

<% if (!environmentModeHidden){%>
<TR><TD>&nbsp;</TD>
<%
if(rtlLayout)
{
%>
<TD align="right">
<%
}
else
{
%>
<TD align="left">
<%}%>
<table cellpadding=0 cellspacing=0>
<tr><td>
<A tabindex="-1" HREF="#content"><img src="<webgui:resourceUrl resourceUrl="images/login/1pix_shim.gif"/>" border=0 alt="<%=resource.getString("SKIP_NAVIGATION_LINKS")%>"></A>

</td><td>
<a tabindex="-1" href="javascript:toggleAdvanced();"  onFocus="highlight();"  onBlur="unhighlight();"><img ID="ADVANCED_IMG" src="<webgui:resourceUrl resourceUrl="images/toggle_down.gif"/>" ALT="<%=resource.getString("JH_UP_DOWN_TOGGLE")%>" align="absmiddle" class="loginNoBorder"></a>
&nbsp;</td><td>
<nobr><a title="<%=resource.getString("JH_LOGINDETAILS")%>" href="javascript:toggleAdvanced();" onFocus="highlight();" onBlur="unhighlight();"><%=resource.getString("JH_LOGINDETAILS")%></a></nobr>
</td></tr>
</table>
</TD></TR>
<TR><TD><A NAME="content"></a></TD></TR>
<TR><TD class="loginText"><div id="ADVANCED_ENV1" style="display: none;"><LABEL FOR="<%=LoginDisplayManager.ENVIRONMENT%>"><%=resource.getString("JH_ENVIRONMENT")%></LABEL><!--4JTidy--></div></TD><TD><div id="ADVANCED_ENV2" style="display: none;"><INPUT SIZE=15 class="textfield" TYPE=text NAME="<%=LoginDisplayManager.ENVIRONMENT%>" ID="<%=LoginDisplayManager.ENVIRONMENT%>" VALUE="<%=(environment.equals("")?defaultEnvironment:environment)%>" <%if(environmentReadOnly){%>readonly style="color: Gray;"<%}%>></div></TD></TR>
<%	if (roleChooserOn)
	{
		%><TR><TD class="loginText"><div id="ADVANCED_ROLE1" style="display: none;"><LABEL FOR="<%=LoginDisplayManager.ROLE%>"><%=resource.getString("JH_ROLEUSER")%></LABEL></div></TD><TD><div id="ADVANCED_ROLE2" style="display: none;"><INPUT SIZE=15 TYPE=text class="textfield" NAME="<%=LoginDisplayManager.ROLE%>" ID="<%=LoginDisplayManager.ROLE%>" VALUE="<%=(role.equals("")?defaultRole:role)%>"></div></TD></TR><%
	}
	else
	{
		%><INPUT SIZE=20 TYPE=hidden NAME="<%=LoginDisplayManager.ROLE%>" ID="<%=LoginDisplayManager.ROLE%>" VALUE="<%=(role.equals("")?defaultRole:role)%>"><%
	} //Endif roleChooserOn
  } //Endif environmentModeHidden
} //Endif not errors%>

<tr><td>&nbsp;</td>
<%
if(rtlLayout)
{
%>
<td class="loginAlignRight">
<%
}
else
{
%>
<td class="loginAlignLeft">
<%
}
%>
<div id="ADVANCED_CHECKBOX" style="display: block;"><%
if (useRememberMe)
{
	%><table class="loginNoBorder" cellpadding=0 cellspacing=0><tr><td><INPUT SIZE=4 TYPE=checkbox NAME=<%=LoginDisplayManager.REMEMBERME%> ID=<%=LoginDisplayManager.REMEMBERME%> VALUE="<%=LoginDisplayManager.YES%>" <%
	if (rememberMeChecked)
		out.print("CHECKED");
	%>></td><td nowrap class="loginText"><LABEL FOR="<%=LoginDisplayManager.REMEMBERME%>"><%=resource.getString("JH_COOKIE")%></LABEL></td></tr></table><%
}
%></div></td></tr>
<tr><td>&nbsp;</td><td>
<%if(isPasswordAboutToExpire){%>
<INPUT class="button loginButtonWidth" TYPE=submit VALUE="<%=resource.getString("JH_CHANGEPASSWORDNOW")%>" >
</td></tr>
<tr><td>&nbsp;</td><td>
<INPUT class="button loginButtonWidth" TYPE=button VALUE="<%=resource.getString("JH_CHANGEPASSWORDLATER")%>" onclick="javascript:doSubmitPWLater();">
<%}
else
{%>
<INPUT class="button" TYPE=submit VALUE="<%=resource.getString("JH_LOGINBUTTON")%>" onclick="return isFirstClick()">
<%}%>
</td></tr>
</TABLE>
<%=JSPUtilities.getHiddenPassthroughFields(params)%>
</FORM>
<SCRIPT language="JavaScript1.2">
var jdeLegalInfo = "<%=resource.getString("JH_LEGALINFOWEBJAVASCRIPT")%>";
</SCRIPT>
</TD></TR>
</TABLE>
<%//End of the login frame%>
</td></tr>
</table>
<%=renderLoginDisclaimer()%>
</td></tr></table></td></tr>
<tr><td class="loginBottomSpace">
</td></tr></table>
<%=renderEndingLoginDecoration(loginImage)%>
<%//End of SWAN style login screen%>

<noscript><%=resource.getString("NOSCRIPT_ACCESSIBILITY")%></noscript>
</div>

</BODY>
</HTML>


La zone à récupérer est contenu dans l’ID : <%=LoginDisplayManager.USERID%> et je voudrais l’avoir dès que le formulaire est soumis, pouvez-vous m’aider?