Example #1
0
    /// <summary>
    /// Returns link for document view.
    /// </summary>
    /// <param name="documentId">Document ID</param>
    /// <param name="taskTitle">Task title</param>
    /// <param name="taskType">Type of the task</param>
    protected string GetDocumentLink(object documentId, object taskTitle, object taskType)
    {
        string title = ValidationHelper.GetString(taskTitle, string.Empty);
        string type  = ValidationHelper.GetString(taskType, string.Empty).ToLowerCSafe();
        int    docId = ValidationHelper.GetInteger(documentId, 0);

        if ((type != "deletedoc") && (type != "deleteallculutres"))
        {
            string viewMode = ViewModeCode.LiveSite.ToString();

            // For publish tasks display document in preview mode
            if ((type == "publishdoc") || (type == "archivedoc"))
            {
                viewMode = ViewModeCode.Preview.ToString();
            }

            // Get document url
            string docUrl = ResolveUrl(CMSContext.GetDocumentUrl(docId)) + "?viewmode=" + viewMode;
            return("<a target=\"_blank\" href=\"" + docUrl + "\">" + HTMLHelper.HTMLEncode(title) + "</a>");
        }
        return(title);
    }