Custom Icon display issue

We are having an issue trying to add in a custom icon using the IconEvalutor class.

Please see below the steps we took. We dont see any errors in the logs and in luminis but the icon does not display.

For those that have done this before, can you take a look at our steps to see what we missed and where we might have gone wrong?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

What system are you on? Are

What system are you on? Are you getting errors in your cp.log?

Also contact Sungard support, none of it was working for us either and then we contacted them and they said... "oh yea that does not work ":( I was angry.

Anyway there are some other posts here on this topic. Take a read.

The steps we took

We are on Windows 2000 OS with 3.3.3.64 version of Luminis.
We must be missing one/many steps somewhere.
For anyone who has been successful on this, please take a look and let us know where we went wrong.

We followed the CDK Version C (November 20, 2006) guide starting on page 4.57.

Our steps were:

- Copied the blackboard_dft.gif and blackboard_roll.gif icons into $CP_ROOT/webapps/luminis/media/org/jasig/portal/layout/tab-column/nested-tables/cp/controls.
- Add a new system property to setup the conditionality of the icon
(configman -s blackboard.enabled true)
- Add this property to the cpInfo.properties file by putting "blackboard.enabled:prop" in $CP_ROOT/webapps/luminis/WEB-INF/config/cpinfo.properties

- Extend the IconEvaluator class by copying the code from the code sample 4-5 on page 4.58 of the CDK.
The only change we made was to substitute WEBCT with BLACKBOARD.

We saved this as a new file named NewIconEvaluator.java.
We put the new Java code in $CP_ROOT\webapps\luminis\WEB-INF\classes\com\sungardhe\cpicons directory.

- We copied and extracted uPortal.jar.
- We edited the channel.xsl file that is in the org\jasig\portal\channels\cpicons directory of the extracted jar.

We added the xsl command to test if the blackboard icon should be displayed:
< xsl:if test="//icons[@blackboard='true']">
< TD ALIGN="CENTER">< A HREF="javascript:OpenWin('blackboard');" onMouseover="img_act('blackboard'); window.status=''; return true;" onMouseOut="img_inact('blackboard');">< IMG SRC="{$mediaPath}/{$skin}/controls/blackboard_dft.gif" ALT="blackboard" NAME="custom" WIDTH="39" HEIGHT="26" BORDER="0" HSPACE="6"/>
blackboard< /A>< /TD>
< /xsl:if>
< !-- end of blackboard mod -->

- We jarred back up the uPortal.jar file.
We stopped Luminis, put the new jar in place, and started Luminis back up.

- We set the custom evaluator in Cgywin:
configman -s org.jasig.portal.channels.cpicons.icon_evaluator com.sungardhe.cpicons.NewIconEvaluator

- Stopped and restarted Luminis.

- We edited the section of the nested-tables.xsl file in the $CP_ROOT\webapps\luminis\stylesheets\org\jasig\portal\layout\tab-column\nested-tables to add the following lines:

blackboardn = new Image(39, 26);
blackboardn.src = "//controls/blackboard_roll.gif";

blackboardf = new Image(39, 26);
blackboardf.src = "//controls/blackboard_dft.gif";

- We compiled the NewIconEvaluator.java in the $CP_ROOT/webapps/luminis/WEB-INF/classes/com/sungardhe/cpicons directory.

- To compile the NewIconEvaluator.java file:
we run ". Cpclasspath" in cygwin
we run "cd /luminis/webapps/luminis/WEB-INF/classes/com/sungardhe/cpicons" in cygwin,
we run "$CP_ROOT/products/jdk/bin/javac NewIconEvaluator.java" in Cgywin

- We did not reset the value the custom evaluator in Cgywin as we did this already.

- Stopped and restarted Luminis.

Custom Icon - missing step

Hi,

You would want to add some code in the OpenWin(w, wURL, wStats) function in nested-tables.xsl, in order for the Blackboard icon to work.

If you look inside this function, you would see some code for "webct" - i.e.

else if (w == "webct")
{
webctWindow = window.open( wURL , 'webctWindow', wStats);
setTimeout ('webctWindow.focus ()', 500);
navigator.cpChildWindowList[navigator.cpChildWindowList.length] = webctWindow;
}

You need to have something similar
for Blackboard , i.e,

else if (w == "blackboard")
{ stats='resizable=yes,scrollbars=yes,toolbar=yes,location=yes,directories=no,status=yes,menubar=y
es,';
stats += center(775, 550);
blackboardWindow = open(" *insert blackboard cpip url*","blackboardWindow",stats);

}

What goes inside the above section depends on how you want the BB window to be opened. We had BB open in a new window, independent of Luminis, and our code was tailored for that.

HTH,
Shyam

We already had that codes in nested-table.xsl

Hi Shyam

Thanks for the comment. Our problem is that the Blackboard Icon would not even show when users logon to our luminis. Other icons (Email, Admin, Group...) are ok.

Any idea??

Alan

NewIconEvaluator.java

Hi Alan,
Could you post your NewIconEvaluator.java code here ?

Also, what is the location of your compiled NewIconEvaluator.class ?

Shyam

NewIconEvaluator.java

Hi Shyam

Here is the file, nothing fancy and directly from the CDK guide except name change:
========================
package com.sungardhe.cpicons;
import java.util.Map;
import org.w3c.dom.Element;
import org.jasig.portal.channels.cpicons.IconEvaluator;
import org.jasig.portal.services.LogService;
import campuspipeline.uportal.dlm.provider.ExtensionClass;
public class NewIconEvaluator extends IconEvaluator
{
private static final String BLACKBOARD_ICON = "blackboard";
public Map evaluate( Element cpInfo )
{
Map icons = super.evaluate( cpInfo );
boolean blackboardEnabled = false;
try
{
// Test to see if blackboard.enabled is set to true
if (ExtensionClass.getDirectoryProperty("blackboard.enabled ")
.equalsIgnoreCase("true") )
{
blackboardEnabled = true;
}
// Update the icon map
icons.put(BLACKBOARD_ICON, "" + blackboardEnabled );
}
catch( Exception ex )
{
LogService.log( LogService.ERROR, "failed to evaluate system property", ex);
}
return icons;
}
}
======================

We put the class in D:\luminis\webapps\luminis\WEB-INF\classes\com\sungardhe\cpicons

Alan

Typo in code ?

Alan,

Your Java code looks good except that I noticed a small typo in it - i.e., in the below statement there is a space after "blackboard.enabled", which might be the culprit !!

if (ExtensionClass.getDirectoryProperty("blackboard.enabled ").equalsIgnoreCase("true") )

Just try recompiling your code after removing the space and see what happens.

Shyam

Good find! but BB icon still won't show.

Thank you very much for your help!!

Alan

Restart Luminis ?

You probably need to restart Luminis after you recompile the Java class.
Let me know when you (hopefully) get this to work!

Shyam

we did restart luminis

Hi Shyam

I did restart luminis every time we made the change.

Alan

Space Typo Was My Problem

Thanks so much! The space was the problem I was having too.  That fixed it for my server.

try NOT using ExtensionClass

We had an issue with our custom IconEvaluator class in that we were receiving exception errors very often in cp.log, but it seemed most users were getting the icons as intended. We later found out that some students were getting the faculty/staff version of the email icon. I sent a request to SunGard and they said not to use the ExtensionClass method as posted in the CDK. As of hotfix 32, they have an updated document with some different ways of finding system properties.

Remove the import ...ExtensionClass line
replace
if (ExtensionClass.getDirectoryProperty("blackboard.enabled ").equalsIgnoreCase("true") )
with
if ( getDirectoryProperty(cpInfo,"blackboard.enabled").equalsIgnoreCase("true") )

This can also be used to find the user's roles:
String[] userRoles = (String[])getLDAPAttributes(cpInfo,"pdsRole").toArray(new String[0]);
instead of
String[] userRoles = ExtensionClass.getLDAPAttributes("pdsRole");

I don't see where I can upload the doc, but it's called "CP icons customize.doc" if you want to ask SunGard for it.

Hope this helps.

Got error when compiled

Hi jrcole

I got the following error when followed your instruction, Alan

NewIconEvaluator.java:18: getDirectoryProperty(org.w3c.dom.Element,java.lang.String) in org.jasig.po
s.IconEvaluator cannot be applied to (java.lang.String)
if (getDirectoryProperty("blackboard.enabled")
^
1 error

getDirectoryProperty() parameters

The getDirectoryProperty function now takes two parameters, the first being the Element cpInfo:

getDirectoryProperty(cpInfo,"blackboard.enabled")

Jason

i got it, thanks!

but the Blackboard icon is still not showing!! :(

You might try to remove an icon

to see if your custom IconEvaluator class is working at all. To remove the Admin icon:

icons.put( IconEvaluator.ADMIN_ICON, "false" );

You can play around with where you place that line (such as inside the if(blackboard.enabled) to see if that test is working).

Good idea! I will try

Thanks again for your kind help!

Alan

Thanks so much!

Hi Jason

I hardcoded the following line:

icons.put(BLACKBOARD_ICON, "true");

and our BB icon finally shows!!! Thank you very much.

Alan

Removing the ExtensionClass

Thanks for the tip on removing the use of ExtensionClass, this saved my hide. In the past our custom IconEvaluator was just too inconsistent to be usable, but having revisited the problem, thanks to your post I was able to get it operating so far with 100% accuracy.

Syndicate content