private void Display_ViewForm() { bool CanIAddLang = true; bool TaskExists = false; PermissionData security_task_data; m_refContent = m_refContentApi.EkContentRef; //Check to see if it's passing it by content-id if (Request.QueryString["form_content_id"] != null && Request.QueryString["form_content_id"] != "") { m_intFormId = Convert.ToInt64(Request.QueryString["form_content_id"]); form_data = m_refContentApi.GetFormById(m_intFormId); } else { form_data = m_refContentApi.GetFormById(m_intFormId); } if (form_data == null) { throw (new Exception("Unable to view form. ID=" + m_intFormId)); } if (Request.QueryString["staged"] != null && Request.QueryString["staged"] != "") { content_data = m_refContentApi.GetContentById(form_data.Id, ContentAPI.ContentResultType.Staged); } else { content_data = m_refContentApi.GetContentById(form_data.Id, 0); } TaskExists = m_refContent.DoesTaskExistForContent(form_data.Id); security_task_data = m_refContentApi.LoadPermissions(form_data.Id, "tasks", ContentAPI.PermissionResultType.Task); security_data = m_refContentApi.LoadPermissions(form_data.Id, "content", ContentAPI.PermissionResultType.All); security_data.CanAddTask = security_task_data.CanAddTask; security_data.CanDestructTask = security_task_data.CanDestructTask; security_data.CanRedirectTask = security_task_data.CanRedirectTask; security_data.CanDeleteTask = security_task_data.CanDeleteTask; CanIAddLang = security_data.CanAdd; // Replace [srcpath] with actual path. [srcpath] is used in calendar field. if (content_data.Html != null&& content_data.Html.Length > 0) { td_vf_content.InnerHtml = content_data.Html.Replace("[srcpath]", m_refContentApi.ApplicationPath + m_refContentApi.AppeWebPath); td_vf_content.InnerHtml = td_vf_content.InnerHtml.Replace("[skinpath]", m_refContentApi.ApplicationPath + "csslib/ContentDesigner/"); } else { td_vf_content.InnerHtml = content_data.Html; } if (content_data.Teaser.Length > 0) { td_vf_summary.InnerHtml = DisplayFormDesign(content_data.Teaser); } else { td_vf_summary.InnerHtml = "<p>" + m_refMsg.GetMessage("lbl place post back message here") + "</p>"; } ViewToolBar(); Populate_ViewForm(form_data); }
public bool ViewContent() { if (!(Request.QueryString["id"] == null)) { m_intId = Convert.ToInt64(Request.QueryString["id"]); if (m_intId == 0) { if (!(Request.QueryString["contentid"] == null)) { m_intId = Convert.ToInt64(Request.QueryString["contentid"]); } } } if (!(Request.QueryString["action"] == null)) { m_strPageAction = Convert.ToString(Request.QueryString["action"]).ToLower().Trim(); } if (!(Request.QueryString["orderby"] == null)) { m_strOrderBy = Convert.ToString(Request.QueryString["orderby"]); } if (!(Request.QueryString["LangType"] == null)) { if (Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } } else { if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID")); } } if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { m_refContentApi.ContentLanguage = ContentLanguage; } if (!(Request.QueryString["cancelaction"] == null)) { if (Convert.ToString(Request.QueryString["cancelaction"]).ToLower() == "undocheckout") { bool retval = false; m_refContent = m_refContentApi.EkContentRef; retval = m_refContent.UndoCheckOutv2_0(m_intId); } } language_data = (new SiteAPI()).GetLanguageById(ContentLanguage); LanguageName = language_data.Name; m_refContent = m_refContentApi.EkContentRef; TaskExists = m_refContent.DoesTaskExistForContent(m_intId); CurrentUserId = m_refContentApi.UserId; AppImgPath = m_refContentApi.AppImgPath; SitePath = m_refContentApi.SitePath; EnableMultilingual = m_refContentApi.EnableMultilingual; if (!(Request.QueryString["callerpage"] == null)) { CallerPage = AntiXss.UrlEncode(Request.QueryString["callerpage"]); } if (CallerPage == "") { if (!(Request.QueryString["calledfrom"] == null)) { CallerPage = AntiXss.UrlEncode(Request.QueryString["calledfrom"]); } } if (!(Request.QueryString["folder_id"] == null)) { if (Request.QueryString["folder_id"] != "") { m_intFolderId = Convert.ToInt64(Request.QueryString["folder_id"]); } } if (m_intFolderId == -1) { //let try again to get folder id if (!(Request.QueryString["fldid"] == null)) { if (Request.QueryString["fldid"] != "") { m_intFolderId = Convert.ToInt64(Request.QueryString["fldid"]); } } } Display_ViewContent(); return true; }
//END: blog - SK private void Page_Load(System.Object sender, System.EventArgs e) { string fldid; m_refMsg = m_refAPI.EkMsgRef; m_sPage = Request.QueryString["page"]; aprId = System.Convert.ToInt64(Request.QueryString["id"]); CurrentUserId = m_refAPI.UserId; SitePath = m_refAPI.SitePath; RegisterResources(); if (!(Request.QueryString["LangType"] == null)) { if (Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); m_refAPI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (m_refAPI.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(m_refAPI.GetCookieValue("LastValidLanguageID")); } } } else { if (m_refAPI.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(m_refAPI.GetCookieValue("LastValidLanguageID")); } } m_refAPI.ContentLanguage = ContentLanguage; m_refContent = m_refAPI.EkContentRef; if (Request.QueryString["content"] == "published") { m_cCont = m_refContent.GetContentByIDv2_0(aprId); toggle = "staged"; } else { m_cCont = m_refContent.GetStagedContByIDv2_0(aprId); toggle = "published"; if (m_cCont.Count == 0) { m_cCont = null; m_cCont = m_refContent.GetContentByIDv2_0(aprId); toggle = "staged"; if (m_sPage == "workarea") { Response.Redirect((string)("approval.aspx?action=viewApprovalList&id=" + Request.QueryString["fldid"]), false); } else { Response.Write("<script language=\"Javascript\">" + "top.opener.location.reload(true);" + "top.close();" + "</script>"); } } } m_meObj = m_refContent.CanIv2_0(aprId, "content"); fldid = m_cCont["FolderID"].ToString(); cApprovals = m_refContent.GetCurrentApprovalInfoByIDv1_1(aprId); m_TaskExists = m_refContent.DoesTaskExistForContent(Convert.ToInt64(m_cCont["ContentID"])); ViewContent(); }