Author Topic: Custom GAD Tab example  (Read 16757 times)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Custom GAD Tab example
« on: November 04, 2008, 11:45:36 PM »
Hi guys,
I'm playing with GAD and deploying the examples, specially I want to open a new tab and show an external URL, however to understand well how this works I began with the example at the development guide.

1. Created the custom file

[code]
<gcn-resources>
<desktop>
<dictionary-class>custom</dictionary-class>
<interaction-information>
<javascript-onload>
<![CDATA[
selectTabByName(TAB_INTERACTION_INFORMATION_CUSTOM_ATTACHED_DATA);
]]>
</javascript-onload>
</interaction-information>


<customer-records>
<javascript-onload>
<![CDATA[
switch(interactionType) {
case INTERACTION_CHAT:
selectTabByName(TAB_CUSTOMER_RECORDS_HISTORY);
break;
case INTERACTION_VOICE:
selectTabByName("additionalInformation");
break;
}]]>
</javascript-onload>
<tabs>
<tab name="additionalInformation">
<dictionary-key>additionalInformation</dictionary-key>
<javascript-onselect>
<![CDATA[
document.forms.additionalInformationForm.target = getDetailFrameName();
document.forms.additionalInformationForm.elements.idInteraction.value = idInteraction;
document.forms.additionalInformationForm.elements.idContact.value = idContact;
document.forms.additionalInformationForm.submit();
]]>
</javascript-onselect>
<html-body>
<![CDATA[
<form name="additionalInformationForm" action="custom\additionalInformation.jsp">
<input type="hidden" name="idInteraction">
<input type="hidden" name="idContact">
</form>
]]>
</html-body>
</tab>
</tabs>
</customer-records>

</desktop>
</gcn-resources>
[/code]

2. Then created the frame file on same folder:
[code]
<%@ page language="java" buffer="none" contentType="text/
html; charset=utf-8" %>
<%
com.genesyslab.ail.AilFactory factory =com.genesyslab.ail.AilLoader.getAilFactory();
com.genesyslab.ail.Interaction interaction =factory.getInteraction( (String)request.getParameter("idInteraction" ) );
com.genesyslab.ail.Contact contact = null;
com.genesyslab.ail.ContactManager contactManager =factory.getContactManager();
if (contactManager != null)
contact = factory.getContactManager().getContact((String)request.getParameter( "idContact" ) ,null);
%>
<html>
<head>
<title>Additional Information</title>
</head>
<body style="font-size: 10pt;" bgcolor="#ffcccc">
<% if( contact != null ) { %>
Contact:
<b>
<%=contact.getTitle()%>
<%=contact.getFirstName()%>
<%=contact.getLastName()%>
</b><br>
Primary Phone Number:
<b>
<%=contact.getPrimaryPhoneNumber()%>
</b><br>
Primary E-mail Address:
<b>
<%=contact.getPrimaryEmailAddress()%></b><br>
<% } else { %>
<center>
<b>
Contact Information Not Available
</b>
</center><br>
<% } %>
<hr>
<% if( interaction != null ) { %>
Date of Creation:
<b>
<%=interaction.getDateCreated()%>
</b><br>
Agent:
<b>
<%=interaction.getUserName()%>
</b><br>
Subject:
<b>
<%=interaction.getSubject()%>
</b><br>
<% if( interaction.getDn() != null ) { %>
Dn:
<b>
<%=interaction.getDn().getId()%>
</b><br>
<% } else { %>
Dn:
<b>
No Dn Information Available
</b><br>
<% } %>
<% } else { %>
<center>
<b>
Interaction Information Not Available
</b>
</center><br>
<% } %>
</body>
</html>
[/code]

3. Then the dictionary file:
[code]
AdditionalInformation=Additional Information
[/code]


But I get this error:
[code]
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: SvgTag key additionalInformation not found
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:118)


root cause

javax.servlet.ServletException: SvgTag key additionalInformation not found
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.interaction.customer_002drecords_002dtab_jsp._jspService(customer_002drecords_002dtab_jsp.java:1012)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:118)


root cause

javax.servlet.jsp.JspTagException: SvgTag key additionalInformation not found
com.genesyslab.uadthin.taglib.SvgTag.doStartTag(SvgTag.java:227)
org.apache.jsp.interaction.customer_002drecords_002dtab_jsp._jspService(customer_002drecords_002dtab_jsp.java:314)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.genesyslab.uadthin.filter.CachePreventFilter.doFilter(CachePreventFilter.java:30)
com.genesyslab.uadthin.filter.UTF8Filter.doFilter(UTF8Filter.java:118)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
[/code]

And found that has to be with this line at the custom.xml file:

<dictionary-key>additionalInformation</dictionary-key>

What can be? I have tried to rename everything without success...
any ideas?

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Custom GAD Tab example
« Reply #1 on: November 05, 2008, 03:32:28 PM »
Hi Cavagnaro,

Seems to me you're "fighting" with GAD a bit ;). But it's great you didn't give up!

Your issue relates to fact that you defined a custom "dictionary" (tags dictionary-class and dictionary-key in custom.xml file) but such dictionary doesn't exists. So you have to do following:

1. Go to the folder "/webapps/gdesktop/WEB-INF/classes/" and create here new file named "custom.properties"
2. Insert following line to this file

        additionalInformation=New tab by Cavagnaro!

3. Try to display your tab. Maybe GAD restart will be required.

R.

PS. As usually, haven't had a chance to test it so use it on your own risk :o

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #2 on: November 05, 2008, 03:52:36 PM »
Hi René,
Yeah I'm trying to exploit all what this can do and show customers the potential...
I already created that file...seems like it can't find it...the custom.properties needs some other line? or just that line?

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Custom GAD Tab example
« Reply #3 on: November 05, 2008, 04:05:06 PM »
No, just the one line should be sufficient. Each line contains key (defined in XML) and value.

Tip: If you don't need to use the dictionary remote the tag "dictionary-key" and it should work then. Dictionaries are used mainly for translation purposes.

R.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #4 on: November 05, 2008, 04:06:15 PM »
Just changed the = XXX by the New Tab by cavagnaro and worked...  ??? ??? why does this system behaves so crazy? lol
Now, GAD asked me to download the .jsp file...is that normal? As no content on the TAB is shown. And how to show an external URL?
Thanks!

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #5 on: November 05, 2008, 06:21:56 PM »
:) Solved the jsp problem, a break line at the header which defined the content type was the problem.
Now will play on how to load an external URL :D

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #6 on: November 05, 2008, 07:05:35 PM »
:o Worked!

[code]
<tab name="Google">
<dictionary-key>Google</dictionary-key>
<scrollbar>true</scrollbar>
<javascript-onselect>
<![CDATA[
document.forms.Google.target = getDetailFrameName();
document.forms.Google.elements.idInteraction.value = idInteraction;
document.forms.Google.elements.idContact.value = idContact;
document.forms.Google.submit();
]]>
</javascript-onselect>
<html-body>
<![CDATA[
<form name="Google" action="http://www.google.com.pe">
<input type="hidden" name="idInteraction">
<input type="hidden" name="idContact">
</form>
]]>
</html-body>
</tab>
[/code]

Offline Luk

  • Newbie
  • *
  • Posts: 27
  • Karma: 0
Re: Custom GAD Tab example
« Reply #7 on: November 06, 2008, 11:14:35 AM »
[quote author=cavagnaro link=topic=3502.msg14827#msg14827 date=1225842336]

And found that has to be with this line at the custom.xml file:

<dictionary-key>additionalInformation</dictionary-key>

What can be? I have tried to rename everything without success...
any ideas?
[/quote]

Hi cavagnaro,

The error is saying "SvgTag key additionalInformation not found" and it didn't find it because it's case-sensitive, so be very carefull.
In your custom.xml
[code]
<tab name="additionalInformation">
<dictionary-key>additionalInformation</dictionary-key>
[/code]

In the dictionary file:
[code]
AdditionalInformation=Additional Information
[/code]

Change the a/A so it matches and your problem is solved. :)

A nice example of GAD customisation is to pop-up Google Maps with the address stored in Contact Server...

Enjoy GAD :)
Luk

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #8 on: November 06, 2008, 03:25:51 PM »
Oh! it was the A! Thanks! Will keep in mind! Yeah saw the video of google! Pretty amazing! Now I'm playing on how to capture attached data :D

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #9 on: November 10, 2008, 06:30:32 AM »
Hey guys, new question,
Trying to capture userName variable however I can't do it. My code is:
[quote]
<javascript-onload>
<![CDATA[
alert("interaction status : " + userName);
}]]>
</javascript-onload>
[/quote]

However I always get a warning message that the variable is not defined, however at the XML Tag Reference guide it says it is availble always. Any idea what am I doing wrong?
Thanks

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Custom GAD Tab example
« Reply #10 on: November 10, 2008, 09:57:00 PM »
Hi Cavagnaro,

The variable "userName" is defined for particular tags only (desktop, menu, menu-item etc.). In what situation you'd like to use it?

R.

PS. What version of GDesktop you have?

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #11 on: November 10, 2008, 10:06:40 PM »
Hi René,
My GAD version is 7.6.01.011.
I want that when my tab Google opens (for example) send as a parameter form the username of the agent. So what I did was:
[code]
<customer-records>
<javascript-onload>
<![CDATA[
alert("The agent is : " + userName);
switch(interactionType) {
case INTERACTION_CHAT:
selectTabByName(TAB_CUSTOMER_RECORDS_HISTORY);
break;
case INTERACTION_VOICE:
selectTabByName("eBDWeb");
break;
}]]>
</javascript-onload>

[/code]
Am I correct? If this shows as alert then will be easy to capture to a variable and then use it to send as hidden parameter of the form.

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Custom GAD Tab example
« Reply #12 on: November 10, 2008, 10:21:37 PM »
There is one "issue" - the variable "userName" is available only for child tag "<javascript-oncustomevent>" as stated in the help. So you can't use it to retrieve agent's name when opening new tab.

There is a way how to do it but it's more complicated. You have to write your own jsp page where you'll retrieve agent's name using AIL and pass it as parameter to other (your) page.

R.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #13 on: November 10, 2008, 10:40:13 PM »
And what is a CustomEvent? I have read again the XML help file and it says:
"all javascript and DTML tags." and then below is another variable for customevent which is customEvent.
I also thought the jsp solution, however I have one question there, following and analyzing the examples, the jsp file retrieves a variable and then call a function to get a data from it. Example contact.getTitle(), but in what documentation I can find all those functions like getTitle?
Thanks a lot René

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Custom GAD Tab example
« Reply #14 on: November 10, 2008, 10:47:20 PM »
Ok, I saw it, under <customer-records> says that it is usable only on oncustomevent, however on <desktop> tag it says it is usable on all tags...which one do I use?