예제 #1
0
    /// <summary>
    /// Gets the metadata link tag.
    /// </summary>
    /// <param name="metadata">The metadata.</param>
    /// <param name="metadataListPage">Metadata filtered list page, can be null.</param>
    /// <returns></returns>
    public static string GetMetadataLinkTag(Metadata metadata, Page metadataListPage)
    {
        string tag = string.Empty;

        if (metadata == null)
            return string.Empty;

        if (metadataListPage == null)
        {
            metadataListPage = Litium.Plus.Utilities.PageUtilities.GetFirstPublishedPageTypeInstance("MetadataFilteredList", CurrentState.Current.WebSiteID, Litium.Foundation.GUI.FoundationContext.Current.Token);
        }

        string metadataTranslation = metadata.Translations.GetMetadataTranslation(CurrentState.Current.WebSite.Culture).Translation;

        if (string.IsNullOrEmpty(metadataTranslation))
            return string.Empty;

        if (metadataListPage == null)
        {
            tag = "<span class=\"metadataSpanTag\">" + metadataTranslation + "</span>";
        }
        else
        {
            string linkTag = string.Format("<a href=\"{0}?MetadataID={1}\">{2}</a>", metadataListPage.GetUrlToPage(), metadata.ID, metadata.Translations.GetMetadataTranslation(CurrentState.Current.WebSite.Culture).Translation);
            tag = "<span class=\"metadataSpanTag\">" + linkTag + "</span>";
        }

        return tag;
    }