cancel
Showing results for 
Search instead for 
Did you mean: 

Banner (rotative) ... ANY HELP WILL BE REWARDED!!!!

Former Member
0 Kudos

I’m working on the development of a rotative banner, for someone that doesn’t know what it is…is a banner (in several web pages you can find one) that change the image present in it once on a while (every certain time), and each one of those image represent a point of entry for accessing to an specific place…in almost all of the cases, different web pages… in my case a specific portal’s role, user profile. The images that I want to present in the banner are store in the km repository. I found a solution that serves me well for my purpose, but I need to find another solution for achieve my goal and now I going to explain why:

I’m using a JSPDynpage PAR, as a parameters of this *.PAR , I get the all the paths where the images are physically store on the server, the names of those images and the paths of the roles (in the PCD) associated to each one of those image. In the before output method, I get the complete path where the image is store, and put it (render it) on my iview, then is executed a wait method and finally with the SUBMIT method, I send again the information (some variables that I need to change the image in the banner) to the browser and that result in the continuing refresh (request – response cycle) of my browser. Its important to know that only the iview’s *.PAR is refreshing when the submit method is execute, not all the page. Know, like I said before all works fine, but the problem is that I want to do this but I don’t want that my browser refresh every certain time…so the question is: is there another way to do this using EPCM API and avoiding the use of the submit method (no refresh the browser)?

Here is the source code if someone need to look it for give me some answers. Any help will be rewarded. Thanx a lot!!!

<%@ page pageEncoding="ISO-8859-1"%>

<%@ page import="java.util.List"%>

<%@ taglib uri="tagLib" prefix="hbj" %>

<%@ page language="java" %>

<%

String RefreshTime = (String) componentRequest.getValue("RefreshTime");

String imgURL = (String) componentRequest.getValue("imgURL");

String name = (String) componentRequest.getValue("name");

String URL = (String) componentRequest.getValue("URL");

%>

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId" >

<hbj:inputField

id="InputName"

type="string"

maxlength="100"

visible = "FALSE"

value="<%=name%>"/>

<hbj:inputField

id="InputURL"

type="string"

maxlength="100"

visible = "FALSE"

value="<%=URL%>"/>

<hbj:gridLayout

id="myGridLayout1"

debugMode="FALSE"

width="100%"

cellSpacing="5">

<hbj:gridLayoutCell

rowIndex="1"

columnIndex="1"

width="100%"

horizontalAlignment="CENTER">

<hbj:link

id="link1"

text=""

target="_TOP">

<hbj:image

src="<%=imgURL%>"

alt="Banners"/>

<% link1.setOnClientClick("javascript:EPCM.doNavigate('"URL"')"); %>

</hbj:link>

</hbj:gridLayoutCell>

</hbj:gridLayout>

</hbj:form>

</hbj:page>

</hbj:content>

<SCRIPT LANGUAGE="JavaScript">

var tid = window.setTimeout("changeMessage()",<%=RefreshTime%>000);

function changeMessage(){

var myFormId = document.getElementById(htmlb_formid);

myFormId.submit();

}

function stopMessageBanner(){

if (typeof tid != "undefined"){

clearTimeout(tid);

}

}

</SCRIPT>

Anexo la clase java

import com.sapportals.htmlb.Image;

import com.sapportals.htmlb.InputField;

import com.sapportals.htmlb.Link;

import com.sapportals.htmlb.page.DynPage;

import com.sapportals.htmlb.page.PageException;

import com.sapportals.portal.htmlb.page.JSPDynPage;

import com.sapportals.portal.htmlb.page.PageProcessorComponent;

import com.sapportals.portal.prt.component.IPortalComponentProfile;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.component.IPortalComponentURI;

public class ZbannersRotatives extends PageProcessorComponent {

public DynPage getPage(){

return new ZbannersRotativesDynPage();

}

public static class ZbannersRotativesDynPage extends JSPDynPage{

private IPortalComponentRequest request;

private IPortalComponentProfile profile;

private String RefreshTime ="";

private String path = "";

private String name1 = "";

private String name2 = "";

private String name3 = "";

private String url1 = "";

private String url2 = "";

private String url3 = "";

private String name = "";

private String URL = "";

public void doInitialization(){

request = (IPortalComponentRequest) this.getRequest();

profile = request.getComponentContext().getProfile();

RefreshTime = profile.getProperty("RefreshTime");

path = profile.getProperty("path");

name3 = profile.getProperty("name3");

url3 = profile.getProperty("url3");

name = name3;

URL = url3;

}

public void doProcessAfterInput() throws PageException {

request = (IPortalComponentRequest) getRequest();

profile = request.getComponentContext().getProfile();

path = profile.getProperty("path");

name1 = profile.getProperty("name1");

name2 = profile.getProperty("name2");

name3 = profile.getProperty("name3");

url1 = profile.getProperty("url1");

url2 = profile.getProperty("url2");

url3 = profile.getProperty("url3");

InputField currentInputName = (InputField) this.getComponentByName("InputName");

InputField currentInputURL = (InputField) this.getComponentByName("InputURL");

String name_var = "";

String url_var = "" ;

if (currentInputName != null) {

name_var = currentInputName.getString().getValue();

url_var = currentInputURL.getString().getValue();

}

if(name_var.equals(name3))

{

name = name1;

URL = url1;

}

if(name_var.equals(name1))

{

name = name2;

URL = url2;

}

if(name_var.equals(name2))

{

name = name3;

URL = url3;

}

}

public void doProcessBeforeOutput() throws PageException {

request = (IPortalComponentRequest) this.getRequest();

profile = request.getComponentContext().getProfile();

RefreshTime = profile.getProperty("RefreshTime");

IPortalComponentURI componentURI = request.createPortalComponentURI();

componentURI.setContextName("com.sap.km.cm.docs");

String docsURI = componentURI.toString();

String imgURL = docsURI + path + "/" + name;

Link linkBanner = new Link("lnkBanner");

linkBanner.setTarget("_blank");

linkBanner.setOnClientClick("javascript:EPCM.doNavigate('"URL"')");

Image oImgBanner = new Image(name,"Banner");

oImgBanner.setTooltip("Ayuda");

linkBanner.addComponent(oImgBanner);

request.putValue("linkBanner",linkBanner);

request.putValue("name",name);

request.putValue("URL",URL);

request.putValue("imgURL",imgURL);

request.putValue("RefreshTime",RefreshTime);

this.setJspName("ZbannersRotatives.jsp");

}

}

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mariana,

why not use javascript to rotate the images? Take a look at this <a href="http://www.quirksmode.org/js/rotate.html">link</a>

Create the array with the images in your jsp and then just let the script run on the page. No reloads, no hassle.

regards,

Dion