Data in custom banner

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
pbrad
Posts: 781
Joined: Mon Jul 17, 2006 11:03 pm
Location: Ontario, Canada

Data in custom banner

Post by pbrad »

Hi,
I would like to always show the LoggedIn.RegularUser Name in the banner area. I am using a custom banner with just straight forward html in it. Is there a way to add a tag into this area?
Thanks,
Pete
aware_support
Posts: 7526
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Hi Pete,

there is a way to do it but it is not straightforward - you have to modify the JSP file that Aware IM generates, which means that you have to re-apply the changes whenever a new version is published.

Let us know if you are interested in the details.
Aware IM Support Team
pbrad
Posts: 781
Joined: Mon Jul 17, 2006 11:03 pm
Location: Ontario, Canada

Post by pbrad »

Yes, I figured it would be that way. If you could let me know which jsp file it is to modify and which folder, I will take it from there. If it is any easier to work with the status line rather than the banner, I could put the information at the bottom of the page but I would like to add the usertype as well. I am already having to paste in the form corners on each version anyway.
Cheers,
Pete
avatar69
Posts: 40
Joined: Thu Mar 01, 2007 5:30 pm
Location: Swindon, UK

Post by avatar69 »

Hi,

I would be interested in modding some of these JSP files - could you post that info here for me?
JTU
Spirax Sarco
aware_support
Posts: 7526
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

There must be a directory under AwareIM/Tomcat/webapps/AwareIM. Its name starts with Header_ and is followed by the business space name. In this directory there is a file called BAS_Header.jsp

You need to modify the file to do the following:
1) Add these lines at the top of the file:
<%@ page import="com.bas.connectionserver.server.IInteractionSession" %>
<%@ page import="com.bas.webapp.misc.WebAppConstants" %>

2) Add the following lines before the <body> tag:

<%
IInteractionSession is = (IInteractionSession) session.getAttribute (WebAppConstants.SERVER_SESSION);
String userName = (String) session.getAttribute (WebAppConstants.LOGIN_NAME);
%>

3) You can now use userName variable inside your HTML. You need to refer to this variable like this:
<%=userName%>

for example,
<p> User name is <%=userName%> </p>
Aware IM Support Team
pbrad
Posts: 781
Joined: Mon Jul 17, 2006 11:03 pm
Location: Ontario, Canada

Post by pbrad »

Great, thanks
avatar69
Posts: 40
Joined: Thu Mar 01, 2007 5:30 pm
Location: Swindon, UK

Post by avatar69 »

Many tanks!
JTU
Spirax Sarco
autonomy2
Posts: 65
Joined: Thu May 18, 2006 10:58 am
Location: Sydney

Banner - business object attributes displayed

Post by autonomy2 »

Hi Support.

To make further use of the banner, would it be possible to display Business Object attributes in a custom banner, by referencing / modifying a .jsp file, similar to the previous suggestion <%=userName%> in this post?
aware_support
Posts: 7526
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

In theory this should be possible although we never tried it. You will need to get the instance of the business object from the server either by its id or by running a query. Let me know how you want to get the business object and we will supply further details.
Aware IM Support Team
autonomy2
Posts: 65
Joined: Thu May 18, 2006 10:58 am
Location: Sydney

Post by autonomy2 »

Hi Support.

Guessing, I would say the preferred method would be by query.

Thanks.
aware_support
Posts: 7526
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Oh well, here goes:

1) Add the following lines at the top of the file:

<%@ page import="com.bas.shared.domain.configuration.elements.Query" %>
<%@ page import="com.bas.shared.domain.operation.IEntity" %>
<%@ page import="com.bas.shared.data.QueryResult" %>
<%@ page import="com.bas.webapp.misc.WebAppUtils" %>

2) Add the following lines before the <body> tag:
<%
String attrValue = "";
Query q = Query.createFromRuleLanguageString ("FIND MyObject WHERE ...");
QueryResult result = (QueryResult) WebAppUtils.sendMessageToExecutionEngine (session.getServletContext(), session, "executeQuery", new Object [] { q, new Integer (1), new Integer (1), null, null }, 1000000);
IEntity [] ents = result.getEntities ();
if (ents != null && ents.length > 0)
attrValue = ents [0].getAttributeValue ("NameOfObjectAttribute");
%>

You can then use attrValue in the HTML tags using it like this
<%=attrValue%>
Aware IM Support Team
BobK
Posts: 545
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Post by BobK »

Are these directions still valid?
aware_support wrote:There must be a directory under AwareIM/Tomcat/webapps/AwareIM. Its name starts with Header_ and is followed by the business space name. In this directory there is a file called BAS_Header.jsp

You need to modify the file to do the following:
1) Add these lines at the top of the file:
<%@ page import="com.bas.connectionserver.server.IInteractionSession" %>
<%@ page import="com.bas.webapp.misc.WebAppConstants" %>

2) Add the following lines before the <body> tag:

<%
IInteractionSession is = (IInteractionSession) session.getAttribute (WebAppConstants.SERVER_SESSION);
String userName = (String) session.getAttribute (WebAppConstants.LOGIN_NAME);
%>

3) You can now use userName variable inside your HTML. You need to refer to this variable like this:
<%=userName%>

for example,
<p> User name is <%=userName%> </p>
I would like to do the same thing but do not have the directory under AwareIM/Tomcat/webapps/AwareIM with a name starts with Header_ and is followed by the business space name. I do have a directory that starts with "BAS_Banner_Main_Main_" followed by the business space name and visual perspective. This directory does not have any jsp files, just my HTML file.
aware_support
Posts: 7526
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

No, this file is not there any more. The banner files are stored in the directory you mentioned. There are also "LAYOUT" files in the AwareIM/Tomcat/webapps/AwareIM directory that control overall layout of the screen. So you need to add the same changes to one of these files - depends where you want it to be.
Aware IM Support Team
BobK
Posts: 545
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Post by BobK »

Thanks Support.

Here are a few more questions.

What attributes can be accessed this way?

Specifically, I have my own business object I use for logins. I added this object to the SystemUser in the Business object groups. Can I access the different attributes of this object?

If not, can I access it by performing a query similar to what is described in one of the above replies?

Would it be easier to get the business object from the server by its id? How would I determine the id?

Thanks again.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Re: getting an ID

ID is listed as an available attribute when displaying query results.

Tom
Post Reply