Ejemplo n.º 1
0
    /// <summary>
    /// Generates the HTML for the child folders under the given folder
    /// </summary>
    /// <param name="controlId">The ID of the surrounding AJAX folder control.</param>
    /// <param name="folderId">The folder ID.</param>
    /// <returns>The HTML list element for one row of the folder tree.</returns>
    protected string GenerateTreeHtml(string controlId, long folderId, string username, string password)
    {
        contentAPI = new Ektron.Cms.ContentAPI();
        siteAPI = new SiteAPI();

        if (!siteAPI.IsLoggedIn)
            return "<div class=\"ekError\">Please login</div>";

        List<ContentData> contentList = null;

        try{
            int totalPages = 1;
            contentList = new List<ContentData>(
                contentAPI.GetChildContentByFolderId(folderId, false, "Title", 0, ref totalPages, 300));
        }
        catch
        {

        }

        StringBuilder sb = new StringBuilder();
        if (contentList != null)
        {
            if (contentList.Count != 0)
            {
                sb.Append("<ul>");
                foreach (ContentData content in contentList)
                {
                    sb.Append("<li><a href='#' onclick='ekSelectContent" + controlId + "(this, " + content.Id + ", \"" + controlId + "\");' >" + content.Title + "</a></li>");
                }
                sb.Append("</ul>");
            }
        }
        return sb.ToString();
    }