Example #1
0
        /// <summary>
        /// Creates the flag icon.
        /// </summary>
        /// <param name="langName">Name of the lang.</param>
        /// <param name="langId">The lang id.</param>
        private void CreateFlagIcon(string langName, int langId)
        {
            //create flag cell
            TableCell cellFlag = new TableCell();
            //create image
            Image imgFlag = new Image();

            imgFlag.Width       = 18;
            imgFlag.Height      = 12;
            imgFlag.BorderColor = System.Drawing.Color.Gray;
            imgFlag.BorderWidth = 1;
            //create hyperlink

            HyperLink hlFlag = new HyperLink();

            hlFlag.NavigateUrl = (Mediachase.Cms.GlobalVariable.GetVariable("url", SiteId).StartsWith("http://")) ? "" : "http://";
            CultureInfo culture = CultureInfo.CreateSpecificCulture(langName);

            if (PageHelper.HasLanguageVersion(PageId, langId))
            {
                imgFlag.ImageUrl    = ManagementHelper.GetFlagIcon(CultureInfo.CreateSpecificCulture(langName));
                hlFlag.NavigateUrl += "javascript:CSManagementClient.OpenExternal('" + Mediachase.Cms.GlobalVariable.GetVariable("url", SiteId) + PageOutline + "?CurrentCulture=" + langName + "&_mode=edit" + "');";// +"&UserId=" + Membership.GetUser().ProviderUserKey.ToString();
                hlFlag.ToolTip      = String.Format("{0} [{1}]", Resources.Admin.ViewPage, culture.DisplayName);
            }
            else
            {
                hlFlag.Attributes.Add("onclick", "return confirm('" + Resources.Admin.IsCreatePage + "');");
                hlFlag.ToolTip      = String.Format("{0} [{1}]", Resources.Admin.CreatePage, culture.DisplayName);
                imgFlag.ImageUrl    = ManagementHelper.GetFlagIcon(CultureInfo.CreateSpecificCulture(langName));
                imgFlag.CssClass    = "DisabledIcon";
                hlFlag.NavigateUrl += "javascript:CSManagementClient.OpenExternal('" + Mediachase.Cms.GlobalVariable.GetVariable("url", SiteId) + PageOutline + "?VersionId=-2&CurrentCulture=" + langName + "&_mode=edit" + "');";// "&UserId=" + Membership.GetUser().ProviderUserKey.ToString() + "&CloseWindow=true";
            }
            //add image to hyperlink
            hlFlag.Controls.Add(imgFlag);
            //add flag to cell
            cellFlag.Controls.Add(hlFlag);
            //add cell to row
            trLanguageMenu.Cells.Add(cellFlag);
        }