Esempio n. 1
0
        //---------------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///     22-Mar-2016 - DEPRECATED - Checked and no longer used ...
        ///     If you want to use the default hover image, set the jsIm to be null
        /// </summary>
        public static string GetLiteralMGLLink(
            string linkID, string imID, string imPath, string im, string linkText, string linkAction, bool doHoverOver, string jsIm,
            string toolTip, bool padImageAndText, bool textBeforeIm, int textPixelAdjustment, string cssClass)
        {
            StringBuilder str = new StringBuilder();

            str.Append("<a id='" + linkID + "' href=\"" + linkAction + "\" ");

            if (cssClass != null && cssClass != "")
            {
                str.Append("class=\"" + cssClass + "\" ");
            }

            // only add the a tooltip if there is more than just an image
            if (toolTip != null && toolTip != "")
            {
                str.Append("title=\"" + toolTip + "\" ");
            }


            string padClass = (padImageAndText) ? "" : "class=\"IA2\"";
            string pixAdj   = "";

            if (textPixelAdjustment != 0)
            {
                pixAdj = "style='position:relative;top:" + textPixelAdjustment + "px;'";
            }

            if (imPath != null && imPath != "" && im != null && im != "")
            {
                if (doHoverOver)
                {
                    if (jsIm != null && jsIm != "")
                    {
                        str.Append("onmouseover=\"swapIm('" + imID + "'," + jsIm + "H);\"");
                        str.Append("onmouseout=\"swapIm('" + imID + "'," + jsIm + ");\"");
                    }
                    else
                    {
                        str.Append("onmouseover=\"document.getElementById('" + imID + "').src='" + imPath + HTMLUtilities.GetHoverImageName(im) + "';\"");
                        str.Append("onmouseout=\"document.getElementById('" + imID + "').src='" + imPath + im + "';\"");
                    }
                }
                str.Append(">");

                if (textBeforeIm)
                {
                    if (linkText != null && linkText != "")
                    {
                        str.Append("<span " + padClass + " " + pixAdj + ">" + linkText + "</span>");
                    }
                }

                str.Append("<span " + padClass + "><img id='" + imID + "' border='0' title=\"" + toolTip + "\" src='" + imPath + im + "' /></span>");
            }
            else
            {
                str.Append(">");
            }
            if (textBeforeIm == false)
            {
                if (linkText != null && linkText != "")
                {
                    str.Append("<span " + padClass + " " + pixAdj + ">" + linkText + "</span>");
                }
            }
            str.Append("</a>");

            return(str.ToString());
        }
Esempio n. 2
0
        //--------------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///     22-Mar-2016 - DEPRECATED - Checked and no longer used ...
        /// </summary>
        public static void AddMouseOverEvents(AttributeCollection atts, string imageID, string srcImgPath, string imageFileName)
        {
            // check for tildas and default if found them
            if (srcImgPath != null && srcImgPath.Contains("~"))
            {
                srcImgPath = ImageRootDirectory;
            }

            // see if there is an attribute there already - if so, then append it
            if (atts["onmouseout"] != null && atts["onmouseout"] != "")
            {
                atts["onmouseout"] = atts["onmouseout"] + "document.getElementById('" + imageID + "').src='" + srcImgPath + imageFileName + "';";
            }
            else
            {
                atts.Add("onmouseout", "javascript:document.getElementById('" + imageID + "').src='" + srcImgPath + imageFileName + "';");
            }

            if (atts["onmouseover"] != null && atts["onmouseover"] != "")
            {
                atts["onmouseover"] = atts["onmouseover"] + "document.getElementById('" + imageID + "').src='" + srcImgPath + HTMLUtilities.GetHoverImageName(imageFileName) + "';";
            }
            else
            {
                atts.Add("onmouseover", "javascript:document.getElementById('" + imageID + "').src='" + srcImgPath + HTMLUtilities.GetHoverImageName(imageFileName) + "';");
            }
        }