コード例 #1
0
    private void LoadManualAliasList(string siteID)
    {
        PagingInfo req = new PagingInfo();
        System.Collections.Generic.List<UrlAliasManualData> manualAliasList;
        System.Collections.Generic.List<UrlAliasAutoData> autoAliasList;
        System.Collections.Generic.List<UrlAliasCommunityData> communityAliasList;
        Ektron.Cms.Common.EkEnumeration.UrlAliasingOrderBy orderBy = Ektron.Cms.Common.EkEnumeration.UrlAliasingOrderBy.None;
        Ektron.Cms.Common.EkEnumeration.AutoAliasOrderBy orderAutoAlias = Ektron.Cms.Common.EkEnumeration.AutoAliasOrderBy.None;
        Ektron.Cms.Common.EkEnumeration.CommunityAliasOrderBy orderCommunityAlias = Ektron.Cms.Common.EkEnumeration.CommunityAliasOrderBy.None;
        LocalizationAPI objLocalizationApi = new LocalizationAPI();
        string defaultIcon = string.Empty;
        long currentSiteKey = 0;
        bool _isRemoveAlias = false;
        string mode = string.Empty;
        SiteAPI _refsiteApi = new SiteAPI();
        LanguageData[] languageData = _refsiteApi.GetAllActiveLanguages();
        string strSelectedLanguageName = "";
        string strName;

        req = new PagingInfo(_refContentApi.RequestInformationRef.PagingSize);
        req.CurrentPage = currentPageNumber;

        if (Request.QueryString["action"] == "removealias")
        {
            _isRemoveAlias = true;
        }

        if (Request.QueryString["mode"] == "auto" && !String.IsNullOrEmpty(Request.QueryString["orderby"]))
        {
            orderAutoAlias = (EkEnumeration.AutoAliasOrderBy)Enum.Parse(typeof(EkEnumeration.AutoAliasOrderBy), Convert.ToString(Request.QueryString["orderby"]), true);
        }
        else if (Request.QueryString["mode"] == "community" && !String.IsNullOrEmpty(Request.QueryString["orderby"]))
        {
            orderCommunityAlias = (EkEnumeration.CommunityAliasOrderBy)Enum.Parse(typeof(EkEnumeration.CommunityAliasOrderBy), Convert.ToString(Request.QueryString["orderby"]), true);
        }
        else if (!String.IsNullOrEmpty(Request.QueryString["orderby"]) && Request.QueryString["mode"] != "auto")
        {
            orderBy = (EkEnumeration.UrlAliasingOrderBy)Enum.Parse(typeof(EkEnumeration.UrlAliasingOrderBy), Convert.ToString(Request.QueryString["orderby"]), true);
        }
        if (Page.IsPostBack && (Request.Form["siteSearchItem"] != null))
        {
            long.TryParse((string)(Request.Form["siteSearchItem"]), out currentSiteKey);
        }
        else if (_isRemoveAlias || siteID != "")
        {
            long.TryParse(siteID, out currentSiteKey);
        }
        else
        {
            siteDictionary = _manualAliasList.GetSiteList();
            foreach (System.Collections.Generic.KeyValuePair<long, string> tempLoopVar_siteList in siteDictionary)
            {
                siteList = tempLoopVar_siteList;
                long.TryParse(siteList.Key.ToString(), out currentSiteKey);
                break;
            }
        }
        strKeyWords = Request.Form["txtSearch"];

        mode = Request.QueryString["mode"];

        if (mode == "auto")
        {
            if (!String.IsNullOrEmpty(Request.QueryString["searchlist"]))
            {
                _autoSelectedItem = (EkEnumeration.AutoAliasSearchField)Enum.Parse(typeof(EkEnumeration.AutoAliasSearchField), Convert.ToString(Request.QueryString["searchlist"]), true);
            }
            autoAliasList = _autoAliasList.GetList(req, currentSiteKey, Convert.ToInt32(_refContentApi.GetCookieValue("LastValidLanguageID")), _autoSelectedItem, strKeyWords, orderAutoAlias);
            totalPagesNumber = req.TotalPages;
            PageSettings();
            if ((autoAliasList != null) && autoAliasList.Count > 0)
            {
                if (_isRemoveAlias)
                {
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("DELETE", msgHelper.GetMessage("generic delete title"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(3), Unit.Percentage(3), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ACTIVE", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.Active + "&action=removealias&mode=auto&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl active") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("LANG", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.ContentLanguage + "&mode=auto&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl language") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("SOURCENAME", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.SourceName + "&action=removealias&mode=auto&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl source name") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(15), Unit.Percentage(15), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("TYPE", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.Type + "&action=removealias&mode=auto&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("type label") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ALIAS", msgHelper.GetMessage("lbl example alias"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));

                }
                else
                {
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ACTIVE", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.Active + "&mode=auto&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl active") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("LANG", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.ContentLanguage + "&mode=auto&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl language") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("SOURCENAME", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.SourceName + "&mode=auto&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl source name") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(15), Unit.Percentage(15), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("TYPE", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.Type + "&mode=auto&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("type label") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ALIAS", msgHelper.GetMessage("lbl example alias"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));
                }

                DataTable dt = new DataTable();
                DataRow dr;
                if (_isRemoveAlias)
                {
                    dt.Columns.Add(new DataColumn("DELETE", typeof(string)));
                }
                dt.Columns.Add(new DataColumn("SOURCENAME", typeof(string)));
                dt.Columns.Add(new DataColumn("TYPE", typeof(string)));
                dt.Columns.Add(new DataColumn("ACTIVE", typeof(string)));
                dt.Columns.Add(new DataColumn("ALIAS", typeof(string)));
                dt.Columns.Add(new DataColumn("LANG", typeof(string)));

                for (int i = 0; i <= autoAliasList.Count - 1; i++)
                {
                    dr = dt.NewRow();
                    if (_isRemoveAlias)
                    {
                        dr["DELETE"] = "<input type=\"checkbox\" name=\"deleteAliasId\" value=\"" + (autoAliasList[i].AutoId.ToString()) + "\">";
                    }
                    dr["SOURCENAME"] = "<a href=\"urlautoaliasmaint.aspx?action=view&LangType=" + _refContentApi.GetCookieValue("LastValidLanguageID") + "&fid=" + currentSiteKey + "&id=" + autoAliasList[i].AutoId + "\">" + autoAliasList[i].SourceName + "</a>";
                    if (autoAliasList[i].AutoAliasType == Ektron.Cms.Common.EkEnumeration.AutoAliasType.Folder)
                    {
                        dr["TYPE"] = "<center><img src =\"" + _refContentApi.AppPath + "images/ui/icons/folder.png\" alt=\"" + msgHelper.GetMessage("lbl folder") + "\" title=\"" + msgHelper.GetMessage("lbl folder") + "\"/ ></center>";
                    }
                    else
                    {
                        dr["TYPE"] = "<center><img src =\"" + _refContentApi.AppPath + "images/ui/icons/taxonomy.png\" alt=\"" + msgHelper.GetMessage("generic taxonomy lbl") + "\" title=\"" + msgHelper.GetMessage("generic taxonomy lbl") + "\"/ ></center>";
                    }
                    if (autoAliasList[i].IsEnabled)
                    {
                        dr["ACTIVE"] = "<center><span style=\"color:green\">On</span></center>"; //maliaslist(i).IsEnabled"
                    }
                    else
                    {
                        dr["ACTIVE"] = "<center><span style=\"color:red\">Off</span></center>";
                    }

                    dr["ALIAS"] = autoAliasList[i].Example;
                    if (autoAliasList[i].AutoAliasType == Ektron.Cms.Common.EkEnumeration.AutoAliasType.Taxonomy)
                    {
                        for (int iLang = 0; iLang <= languageData.Length - 1; iLang++)
                        {
                            LanguageData with_1 = languageData[iLang];
                            strName = with_1.LocalName;
                            if (autoAliasList[i].LanguageId == with_1.Id)
                            {
                                strSelectedLanguageName = strName;
                            }
                        }
                    }
                    else
                    {
                        strSelectedLanguageName = "N/A";
                    }
                    dr["LANG"] = "<center><img src=" + objLocalizationApi.GetFlagUrlByLanguageID(System.Convert.ToInt32(autoAliasList[i].LanguageId)) + " alt=\"" + strSelectedLanguageName + "\" title=\"" + strSelectedLanguageName + "\" /></center>";
                    dt.Rows.Add(dr);
                }
                DataView dv = new DataView(dt);
                CollectionListGrid.DataSource = dv;
                CollectionListGrid.DataBind();
            }
        }
        else if (mode == "community")
        {
            communityAliasList = _communityAliasList.GetList(req, currentSiteKey, orderCommunityAlias);
            totalPagesNumber = req.TotalPages;
            PageSettings();
            if (communityAliasList != null && communityAliasList.Count > 0)
            {
                if (_isRemoveAlias)
                {
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("DELETE", msgHelper.GetMessage("generic delete title"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(3), Unit.Percentage(3), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("DEFAULT", "<center>" + msgHelper.GetMessage("lbl primary") + "</center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(2), Unit.Percentage(2), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ACTIVE", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.CommunityAliasOrderBy.Active + "&action=removealias&mode=community&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl active") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ALIAS PATH", msgHelper.GetMessage("lbl alias path"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("TYPE", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.AutoAliasOrderBy.Type + "&action=removealias&mode=community&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("generic type") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ALIAS", msgHelper.GetMessage("lbl example alias"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));

                }
                else
                {
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("DEFAULT", "<center>" + msgHelper.GetMessage("lbl primary") + "</center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(2), Unit.Percentage(2), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ACTIVE", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.CommunityAliasOrderBy.Active + "&mode=community&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl active") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(3), Unit.Percentage(3), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ALIAS PATH", msgHelper.GetMessage("lbl alias path"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("TYPE", "<center><a href=\"urlmanualaliaslistmaint.aspx?orderby=" + EkEnumeration.CommunityAliasOrderBy.Type + "&mode=community&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("generic type") + "</a></center>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ALIAS", msgHelper.GetMessage("lbl example alias"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));

                }

                DataTable dt = new DataTable();
                DataRow dr;
                if (_isRemoveAlias)
                {
                    dt.Columns.Add(new DataColumn("DELETE", typeof(string)));
                }

                dt.Columns.Add(new DataColumn("DEFAULT", typeof(string)));
                dt.Columns.Add(new DataColumn("TYPE", typeof(string)));
                dt.Columns.Add(new DataColumn("ACTIVE", typeof(string)));
                dt.Columns.Add(new DataColumn("ALIAS", typeof(string)));
                dt.Columns.Add(new DataColumn("ALIAS PATH", typeof(string)));

                for (int i = 0; i <= communityAliasList.Count - 1; i++)
                {
                    dr = dt.NewRow();
                    if (_isRemoveAlias)
                    {
                        dr["DELETE"] = "<input type=\"checkbox\" name=\"deleteAliasId\" value=\"" + (communityAliasList[i].Id.ToString()) + "\">";
                    }
                    if (communityAliasList[i].IsDefault)
                    {
                        defaultIcon = "<center><img src=\"" + _refContentApi.AppPath + "images/ui/icons/check.png\" border=\"0\" alt=\"Item is Enabled\" title=\"Item is Enabled\"/></center>";
                        dr["DEFAULT"] = defaultIcon;
                    }
                    if (communityAliasList[i].IsEnabled)
                    {
                        dr["ACTIVE"] = "<center><span style=\"color:green\">On</span></center>";
                    }
                    else
                    {
                        dr["ACTIVE"] = "<center><span style=\"color:red\">Off</span></center>";
                    }
                    if (communityAliasList[i].CommunityAliasType == Ektron.Cms.Common.EkEnumeration.CommunityAliasType.Group)
                    {
                        dr["TYPE"] = "<center><img src =\"" + _refContentApi.AppPath + "images/ui/icons/usersMemberGroups.png\" alt=\"" + msgHelper.GetMessage("lbl group") + "\" title=\"" + msgHelper.GetMessage("lbl group") + "\"/ ></center>";
                    }
                    else
                    {
                        dr["TYPE"] = "<center><img src =\"" + _refContentApi.AppPath + "images/ui/icons/user.png\" alt=\"" + msgHelper.GetMessage("lbl wa mkt user goals") + "\" title=\"" + msgHelper.GetMessage("lbl wa mkt user goals") + "\"/ ></center>";
                    }
                    for (int iLang = 0; iLang <= languageData.Length - 1; iLang++)
                    {
                        LanguageData with_2 = languageData[iLang];
                        strName = with_2.LocalName;
                        if (communityAliasList[i].LanguageId == with_2.Id)
                        {
                            strSelectedLanguageName = strName;
                        }
                    }
                    dr["ALIAS"] = communityAliasList[i].Example;
                    dr["ALIAS PATH"] = "<a href=\"urlcommunityaliasmaint.aspx?action=view&id=" + communityAliasList[i].Id + "&fId=" + communityAliasList[i].SiteId + "&LangType=" + _refContentApi.GetCookieValue("LastValidLanguageID") + "\">" + communityAliasList[i].AliasPath + "</a>";

                    dt.Rows.Add(dr);
                }
                DataView dv = new DataView(dt);
                CollectionListGrid.DataSource = dv;
                CollectionListGrid.DataBind();
            }
        }
        else
        {
            if (!String.IsNullOrEmpty(Request.Form["searchlist"]))
            {
                _strSelectedItem = (EkEnumeration.UrlAliasSearchField)Enum.Parse(typeof(EkEnumeration.UrlAliasSearchField), Convert.ToString((Request.Form["searchlist"])), true);
            }

            manualAliasList = _manualAliasList.GetList(req, currentSiteKey, Convert.ToInt32(_refContentApi.GetCookieValue("LastValidLanguageID")), _strSelectedItem, strKeyWords, orderBy);
            totalPagesNumber = req.TotalPages;

            PageSettings();

            if ((manualAliasList != null) && manualAliasList.Count > 0)
            {
                if (_isRemoveAlias)
                {
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("DELETE", msgHelper.GetMessage("generic delete title"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(3), Unit.Percentage(3), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("DEFAULT", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=4&action=removealias&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl primary") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ACTIVE", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=5&action=removealias&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl active") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(3), Unit.Percentage(3), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("LANG", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=2&fId=" + currentSiteKey.ToString() + "\">"+msgHelper.GetMessage("lbl language")+"</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ALIAS", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=10&action=removealias&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl alias") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ORIGINAL LINK", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=6&action=removealias&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl original link") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(35), Unit.Percentage(40), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("CONTENT ID", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=1&action=removealias&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("generic content id") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(10), Unit.Percentage(10), false, false));
                }
                else
                {
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("DEFAULT", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=4&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl primary") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ACTIVE", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=5&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl active") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(3), Unit.Percentage(3), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("LANG", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=2&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl language") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(4), Unit.Percentage(4), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ALIAS", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=10&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl alias") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(25), Unit.Percentage(25), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("ORIGINAL LINK", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=6&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("lbl original link") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(35), Unit.Percentage(40), false, false));
                    CollectionListGrid.Columns.Add(_refStyle.CreateBoundField("CONTENT ID", "<a href=\"urlmanualaliaslistmaint.aspx?orderby=1&fId=" + currentSiteKey.ToString() + "\">" + msgHelper.GetMessage("generic content id") + "</a>", "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(10), Unit.Percentage(10), false, false));
                }

                DataTable dt = new DataTable();
                DataRow dr;
                if (_isRemoveAlias)
                {
                    dt.Columns.Add(new DataColumn("DELETE", typeof(string)));
                }
                dt.Columns.Add(new DataColumn("DEFAULT", typeof(string)));
                dt.Columns.Add(new DataColumn("ACTIVE", typeof(string)));
                dt.Columns.Add(new DataColumn("LANG", typeof(string)));
                dt.Columns.Add(new DataColumn("ALIAS", typeof(string)));
                dt.Columns.Add(new DataColumn("ORIGINAL LINK", typeof(string)));
                dt.Columns.Add(new DataColumn("CONTENT ID", typeof(string)));

                for (int i = 0; i <= manualAliasList.Count - 1; i++)
                {
                    dr = dt.NewRow();
                    if (_isRemoveAlias)
                    {
                        dr["DELETE"] = "<input type=\"checkbox\" name=\"deleteAliasId\" value=\"" + (manualAliasList[i].AliasId.ToString()) + "\">";
                    }
                    if (manualAliasList[i].IsDefault)
                    {
                        defaultIcon = "<center><img src=\"" + _refContentApi.AppPath + "images/ui/icons/check.png\" border=\"0\" alt=\"Item is Enabled\" title=\"Item is Enabled\"/></center>";
                        dr["DEFAULT"] = defaultIcon;
                    }
                    if (manualAliasList[i].IsEnabled)
                    {
                        dr["ACTIVE"] = "<center><span style=\"color:green\">On</span></center>"; //maliaslist(i).IsEnabled"
                    }
                    else
                    {
                        dr["ACTIVE"] = "<center><span style=\"color:red\">Off</span></center>";
                    }
                    for (int iLang = 0; iLang <= languageData.Length - 1; iLang++)
                    {
                        LanguageData with_3 = languageData[iLang];
                        strName = with_3.LocalName;
                        if (manualAliasList[i].ContentLanguage == with_3.Id)
                        {
                            strSelectedLanguageName = strName;
                        }
                    }
                    dr["LANG"] = "<center><img src=" + objLocalizationApi.GetFlagUrlByLanguageID(System.Convert.ToInt32(manualAliasList[i].ContentLanguage)) + " alt=\"" + strSelectedLanguageName + "\" /></center>";
                    dr["ALIAS"] = "<a href=\"urlmanualaliasmaint.aspx?action=view&id=" + manualAliasList[i].AliasId + "&fId=" + manualAliasList[i].SiteId + "&LangType=" + _refContentApi.GetCookieValue("LastValidLanguageID") + "\">" + manualAliasList[i].DisplayAlias + "</a>";
                    if (manualAliasList[i].Target.ToLower().IndexOf("downloadasset.aspx?") == -1)
                    {
                        dr["ORIGINAL LINK"] = manualAliasList[i].Target;
                    }
                    else
                    {
                        string workareaPath = string.Empty;
                        workareaPath = Strings.Replace(_refContentApi.AppPath, _refContentApi.SitePath, "", 1, 1, 0);
                        dr["ORIGINAL LINK"] = workareaPath + manualAliasList[i].Target;
                    }

                    dr["CONTENT ID"] = manualAliasList[i].ContentId;
                    dt.Rows.Add(dr);
                }
                DataView dv = new DataView(dt);
                CollectionListGrid.DataSource = dv;
                CollectionListGrid.DataBind();
            }
        }
    }
コード例 #2
0
 private void CollectSearchText()
 {
     strKeyWords = (Request.Form["txtSearch"] == null ? "" : Request.Form["txtSearch"]);
     if (Request.Form["searchlist"] != null)
     {
         if (Request.QueryString["mode"] == "auto")
         {
             _autoSelectedItem = (EkEnumeration.AutoAliasSearchField)Enum.Parse(typeof(EkEnumeration.AutoAliasSearchField), Convert.ToString((Request.Form["searchlist"])), true);
         }
         else
         {
             _strSelectedItem = (EkEnumeration.UrlAliasSearchField)Enum.Parse(typeof(EkEnumeration.UrlAliasSearchField), Convert.ToString((Request.Form["searchlist"])), true);
         }
     }
 }