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

View File

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