added onClick attributes to LinkItems and name attributes to ImageItems - NRPA

Conference Center needs these to support LivePerson in the left menu bar
This commit is contained in:
Eric J. Bowersox 2001-11-25 21:46:25 +00:00
parent 8358e5645e
commit 1a7ebd0446
2 changed files with 24 additions and 10 deletions

View File

@ -40,11 +40,12 @@ class ImageItem implements ComponentRender
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private String src; private String src; // image source URL
private String alt = null; private String alt = null; // image alternate text
private int width; private String name = null; // image NAME= attribute
private int height; private int width; // width of image in pixels
private boolean fixup; private int height; // height of image in pixels
private boolean fixup; // does image source URL need fixing up?
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -81,8 +82,11 @@ class ImageItem implements ComponentRender
else else
throw new ConfigException("height= attribute of <image/> element not specified or invalid"); throw new ConfigException("height= attribute of <image/> element not specified or invalid");
// get the rest of the attributes
if (h.hasAttribute("alt")) if (h.hasAttribute("alt"))
alt = elt.getAttribute("alt"); alt = elt.getAttribute("alt");
if (h.hasAttribute("name"))
name = elt.getAttribute("name");
if (h.hasAttribute("fixup")) if (h.hasAttribute("fixup"))
fixup = true; fixup = true;
@ -106,6 +110,8 @@ class ImageItem implements ComponentRender
out.write(src + "\" WIDTH=" + width + " HEIGHT=" + height); out.write(src + "\" WIDTH=" + width + " HEIGHT=" + height);
if (alt!=null) if (alt!=null)
out.write(" ALT=\"" + alt + "\""); out.write(" ALT=\"" + alt + "\"");
if (name!=null)
out.write(" NAME=\"" + name + "\"");
out.write(" BORDER=0>"); out.write(" BORDER=0>");
} // end renderHere } // end renderHere

View File

@ -47,11 +47,12 @@ class LinkItem implements ComponentRender, ColorSelectors
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private String href; private String href; // what we actually link to
private String type; private String type; // the type of item we specify
private boolean enabled = true; private boolean enabled = true; // is this item enabled?
private String target = null; private String target = null; // target window for the link
private ComponentRender contents; private String on_click = null; // onClick JavaScript for the link
private ComponentRender contents; // what does this link contain? (image vs. text)
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructors * Constructors
@ -91,6 +92,10 @@ class LinkItem implements ComponentRender, ColorSelectors
if (h.hasAttribute("target")) if (h.hasAttribute("target"))
target = elt.getAttribute("target"); target = elt.getAttribute("target");
// load the "onClick" script code
if (h.hasAttribute("onClick"))
on_click = elt.getAttribute("onClick");
// load the "disabled" attribute // load the "disabled" attribute
if (h.hasAttribute("disabled")) if (h.hasAttribute("disabled"))
enabled = false; enabled = false;
@ -110,6 +115,7 @@ class LinkItem implements ComponentRender, ColorSelectors
this.type = other.type; this.type = other.type;
this.enabled = other.enabled; this.enabled = other.enabled;
this.target = other.target; this.target = other.target;
this.on_click = StringUtil.replaceAllVariables(other.on_click,vars);
this.contents = other.contents; this.contents = other.contents;
} // end constructor } // end constructor
@ -133,6 +139,8 @@ class LinkItem implements ComponentRender, ColorSelectors
out.write("\" CLASS=\"lbar\""); out.write("\" CLASS=\"lbar\"");
if (target!=null) if (target!=null)
out.write(" TARGET=\"" + target + "\""); out.write(" TARGET=\"" + target + "\"");
if (on_click!=null)
out.write(" onClick=\"" + on_click + "\"");
out.write("><FONT COLOR=\"" + rdat.getStdColor(LEFT_LINK) + "\">"); out.write("><FONT COLOR=\"" + rdat.getStdColor(LEFT_LINK) + "\">");
} // end if } // end if
else // write the "disabled" indicator else // write the "disabled" indicator