public async Task ShouldGetAllPosts(int howManyArticlesToAdd) { // Arrange IPostRepository repository = new FilePostRepository(); try { for (var i = 0; i < howManyArticlesToAdd; i++) { var post = new BlogPostData($"{_data.Title}-{i}", _data.Content); await repository.AddPost(post); } // Act var posts = await repository.GetPosts(); // Assert Check.That(posts.Count).IsEqualTo(howManyArticlesToAdd); Check.That(posts).ContainsOnlyElementsThatMatch(post => !string.IsNullOrWhiteSpace(post.Title) && !string.IsNullOrWhiteSpace(post.Content)); } finally { // Clean await FileService.RemoveAllFiles(); } }
public async Task <IBlogPostData> GetPost(string title) { var(name, content) = await BlobService.GetBlob(title); var post = new BlogPostData(name, content); return(post); }
public IBlogPostData ConvertMarkdownToHtml(IBlogPostData data) { var title = data.Title; var content = data.Content; var contentAsHtml = MarkdigConverter.ConvertToHtml(content); var sanitizedHtml = _sanitizer.Sanitize(contentAsHtml); var result = new BlogPostData(title, sanitizedHtml); return(result); }
public void ShouldConvertMarkdownToHtml() { // Arrange IDataConvertor dataConvertor = new MarkdownDataConvertor(); // Act var originalData = new BlogPostData(Constants.Title, Constants.MarkdownContent); var processedData = dataConvertor.ConvertMarkdownToHtml(originalData); // Assert Check.That(processedData.Title).IsEqualTo(originalData.Title); Check.That(processedData.Content.Equals(Constants.HtmlContent)); }
public IBlogPostData GetData() { var lines = Helpers.ReadLines(_filePath); if (lines.Length != 2) { return(null); } var title = lines[0]; var content = lines[1]; var data = new BlogPostData(title, content); return(data); }
// PUT: api/BlogPosts/5 public void Put([FromBody] BlogPostData model) { if (string.IsNullOrEmpty(model.Title)) { throw new InvalidTitleExeption("ivalid post title", "title is null or empty"); } else if (string.IsNullOrEmpty(model.Body)) { throw new InvalidBodyException("body can't be empty", "body is null or empty"); } var postBL = _mapper.Map <BlogPostBL>(model); _service.Update(postBL); }
public void ShouldDisplayDataInAFile() { // Arrange IDataDisplayer dataDisplayer = new FileDataDisplayer(OutputFile); // Act var data = new BlogPostData(Title, Content); dataDisplayer.DisplayData(data); // Assert var lines = Helpers.ReadLines(OutputFile); Check.That(lines.Length).IsEqualTo(2); Check.That(lines[0]).IsEqualTo(Title); Check.That(lines[1]).IsEqualTo(Content); }
public async Task <IBlogPostData> GetPost(string title) { IBlogPostData result = null; try { var(name, content) = await FileService.GetFile(title); result = new BlogPostData(name, content); } catch (Exception e) { Console.WriteLine(e.ToString()); } return(result); }
private void Page_Load(System.Object sender, System.EventArgs e) { try { 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; } m_refMsg = m_refContentApi.EkMsgRef; if (Request.QueryString["id"] != "") { ContentId = Convert.ToInt64(Request.QueryString["id"]); } if (Request.QueryString["hist_id"] != "") { HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]); } if (!(Page.IsPostBack)) { AppImgPath = m_refContentApi.AppImgPath; AppName = m_refContentApi.AppName; ContentLanguage = m_refContentApi.ContentLanguage; imagePath = m_refContentApi.AppPath + "images/ui/icons/"; content_data = new ContentData(); if (ContentId > 0 && HistoryId > 0) { if (Request.QueryString["xslt"] == "remove") { bApplyXslt = false; } else { bApplyXslt = true; } security_data = m_refContentApi.LoadPermissions(ContentId, "content", ContentAPI.PermissionResultType.Content); m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId); switch (m_contentType) { case EkConstants.CMSContentType_CatalogEntry: Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi(); entry_data = m_refCatalogAPI.GetItem(ContentId); entry_version_data = m_refCatalogAPI.GetItemVersion(ContentId, m_refContentApi.ContentLanguage, HistoryId); PopulateCatalogPageData(entry_version_data, entry_data); Display_EntryHistoryToolBar(entry_data); break; default: content_data = m_refContentApi.GetContentById(ContentId, 0); hist_content_data = m_refContentApi.GetContentByHistoryId(HistoryId); FolderData folder_data; blog_post_data = new BlogPostData(); blog_post_data.Categories = new string[0]; if (!(content_data == null)) { bIsBlog = System.Convert.ToBoolean(m_refContentApi.EkContentRef.GetFolderType(content_data.FolderId) == Ektron.Cms.Common.EkEnumeration.FolderType.Blog); if (bIsBlog) { folder_data = m_refContentApi.GetFolderById(content_data.FolderId); if (hist_content_data.MetaData != null) { for (int i = 0; i <= (hist_content_data.MetaData.Length - 1); i++) { Ektron.Cms.Common.EkEnumeration.BlogPostDataType MetaType = (Ektron.Cms.Common.EkEnumeration.BlogPostDataType)Enum.Parse(typeof(Ektron.Cms.Common.EkEnumeration.BlogPostDataType), hist_content_data.MetaData[i].TypeId.ToString()); if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Categories || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog categories") > -1) { hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace("'", "\'"); hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace(""", "\""); hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace(">", ">"); hist_content_data.MetaData[i].Text = hist_content_data.MetaData[i].Text.Replace("<", "<"); blog_post_data.Categories = Strings.Split((string)(hist_content_data.MetaData[i].Text), ";", -1, 0); } else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Ping || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog pingback") > -1) { blog_post_data.Pingback = Ektron.Cms.Common.EkFunctions.GetBoolFromYesNo((string)(hist_content_data.MetaData[i].Text)); } else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Tags || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog tags") > -1) { blog_post_data.Tags = (string)(hist_content_data.MetaData[i].Text); } else if (MetaType == Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Trackback || hist_content_data.MetaData[i].TypeName.ToLower().IndexOf("blog trackback") > -1) { blog_post_data.TrackBackURL = (string)(hist_content_data.MetaData[i].Text); } } } if (!(folder_data.XmlConfiguration == null)) { bXmlContent = true; } } hist_content_data.Type = content_data.Type; PopulatePageData(hist_content_data, content_data); } Display_ContentHistoryToolBar(); break; } } else if (ContentId > 0) { m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId); switch (m_contentType) { case EkConstants.CMSContentType_CatalogEntry: Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi(); entry_data = m_refCatalogAPI.GetItem(ContentId); entry_version_data = m_refCatalogAPI.GetItemVersion(ContentId, m_refContentApi.ContentLanguage, HistoryId); PopulateCatalogPageData(entry_version_data, entry_data); Display_EntryHistoryToolBar(entry_data); break; default: content_data = m_refContentApi.GetContentById(ContentId, 0); PopulatePageData(hist_content_data, content_data); Display_ContentHistoryToolBar(); break; } } } else { m_contentType = m_refContentApi.EkContentRef.GetContentType(ContentId); content_data = m_refContentApi.GetContentById(ContentId, 0); switch (m_contentType) { case EkConstants.CMSContentType_CatalogEntry: Ektron.Cms.Commerce.CatalogEntryApi m_refCatalogAPI = new Ektron.Cms.Commerce.CatalogEntryApi(); HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]); m_refCatalogAPI.Restore(ContentId, HistoryId); break; default: HistoryId = Convert.ToInt64(Request.QueryString["hist_id"]); m_refContentApi.RestoreHistoryContent(HistoryId); break; } CloseOnRestore.Text = "<script type=\"text/javascript\">try { location.href = \'content.aspx?LangType=" + ContentLanguage + "&action=ViewStaged&id=" + ContentId + "&fldid=" + content_data.FolderId + "\'; } catch(e) {}</script>"; } } catch (Exception ex) { ShowError(ex.Message); } }
private void Display_ViewContent() { m_refMsg = m_refContentApi.EkMsgRef; bool bCanAlias = false; PermissionData security_task_data; StringBuilder sSummaryText; Ektron.Cms.UrlAliasing.UrlAliasManualApi m_aliasname = new Ektron.Cms.UrlAliasing.UrlAliasManualApi(); Ektron.Cms.UrlAliasing.UrlAliasAutoApi m_autoaliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi(); Ektron.Cms.Common.UrlAliasManualData d_alias; System.Collections.Generic.List<Ektron.Cms.Common.UrlAliasAutoData> auto_aliaslist = new System.Collections.Generic.List<Ektron.Cms.Common.UrlAliasAutoData>(); Ektron.Cms.UrlAliasing.UrlAliasSettingsApi m_urlAliasSettings = new Ektron.Cms.UrlAliasing.UrlAliasSettingsApi(); int i; bool IsStagingServer; IsStagingServer = m_refContentApi.RequestInformationRef.IsStaging; security_task_data = m_refContentApi.LoadPermissions(m_intId, "tasks", ContentAPI.PermissionResultType.Task); security_data = m_refContentApi.LoadPermissions(m_intId, "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; active_subscription_list = m_refContentApi.GetAllActiveSubscriptions(); if ("viewstaged" == m_strPageAction) { ContentStateData objContentState; objContentState = m_refContentApi.GetContentState(m_intId); if ("A" == objContentState.Status) { // Can't view staged m_strPageAction = "view"; } } try { if (m_strPageAction == "view") { content_data = m_refContentApi.GetContentById(m_intId, 0); } else if (m_strPageAction == "viewstaged") { content_data = m_refContentApi.GetContentById(m_intId, ContentAPI.ContentResultType.Staged); } } catch (Exception ex) { Response.Redirect("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message), true); return; } if ((content_data != null) && (Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64 (content_data.Type), Convert.ToBoolean (-1)))) { ContentPaneHeight = "700px"; } //ekrw = m_refContentApi.EkUrlRewriteRef() //ekrw.Load() if (((m_urlAliasSettings.IsManualAliasEnabled || m_urlAliasSettings.IsAutoAliasEnabled) && m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) && (content_data != null) && (content_data.AssetData != null) && !(Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_data.AssetData.FileExtension)))) { bCanAlias = true; } blog_post_data = new BlogPostData(); blog_post_data.Categories = (string[])Array.CreateInstance(typeof(string), 0); if (content_data.MetaData != null) { for (i = 0; i <= (content_data.MetaData.Length - 1); i++) { if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog categories") { content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("'", "\'"); content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace(""", "\""); content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace(">", ">"); content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("<", "<"); blog_post_data.Categories = Strings.Split((string)(content_data.MetaData[i].Text), ";", -1, 0); } else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog pingback") { if (!(content_data.MetaData[i].Text.Trim().ToLower() == "no")) { m_bIsBlog = true; } blog_post_data.Pingback = Ektron.Cms.Common.EkFunctions.GetBoolFromYesNo((string)(content_data.MetaData[i].Text)); } else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog tags") { blog_post_data.Tags = (string)(content_data.MetaData[i].Text); } else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog trackback") { blog_post_data.TrackBackURL = (string)(content_data.MetaData[i].Text); } } } //THE FOLLOWING LINES ADDED DUE TO TASK //:BEGIN / PROPOSED BY PAT //TODO: Need to recheck this part of the code e.r. if (content_data == null) { if (ContentLanguage != 0) { if (ContentLanguage.ToString() != (string)(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"])) { Response.Redirect((string)(Request.ServerVariables["URL"] + "?" + Strings.Replace(Request.ServerVariables["Query_String"], (string)("LangType=" + ContentLanguage), (string)("LangType=" + m_refContentApi.DefaultContentLanguage), 1, -1, 0)), false); return; } } else { if (ContentLanguage.ToString() != (string)(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"])) { Response.Redirect((string)(Request.ServerVariables["URL"] + "?" + Request.ServerVariables["Query_String"] + "&LangType=" + m_refContentApi.DefaultContentLanguage), false); return; } } } //:END if (m_intFolderId == -1) { m_intFolderId = content_data.FolderId; } HoldMomentMsg.Text = m_refMsg.GetMessage("one moment msg"); if ((active_subscription_list == null) || (active_subscription_list.Length == 0)) { phWebAlerts.Visible = false; phWebAlerts2.Visible = false; } content_state_data = m_refContentApi.GetContentState(m_intId); jsFolderId.Text = m_intFolderId.ToString (); jsIsForm.Text = content_data.Type.ToString (); jsBackStr.Text = "back_file=content.aspx"; if (m_strPageAction.Length > 0) { jsBackStr.Text += "&back_action=" + m_strPageAction; } if (Convert.ToString(m_intFolderId).Length > 0) { jsBackStr.Text += "&back_folder_id=" + m_intFolderId; } if (Convert.ToString(m_intId).Length > 0) { jsBackStr.Text += "&back_id=" + m_intId; } if (Convert.ToString((short)ContentLanguage).Length > 0) { jsBackStr.Text += "&back_LangType=" + ContentLanguage; } jsToolId.Text = m_intId.ToString (); jsToolAction.Text = m_strPageAction; jsLangId.Text = m_refContentApi.ContentLanguage.ToString (); if (content_data.Type == 3333) { ViewCatalogToolBar(); } else { ViewToolBar(); } if (bCanAlias && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //And folder_data.FolderType <> 1 Don't Show alias tab for Blogs. { string m_strAliasPageName = ""; d_alias = m_aliasname.GetDefaultAlias(content_data.Id); if (d_alias.QueryString != "") { m_strAliasPageName = d_alias.AliasName + d_alias.FileExtension + d_alias.QueryString; //content_data.ManualAlias } else { m_strAliasPageName = d_alias.AliasName + d_alias.FileExtension; //content_data.ManualAlias } if (m_strAliasPageName != "") { if (IsStagingServer && folder_data.DomainStaging != string.Empty) { m_strAliasPageName = (string)("http://" + folder_data.DomainStaging + "/" + m_strAliasPageName); } else if (folder_data.IsDomainFolder) { m_strAliasPageName = (string)("http://" + folder_data.DomainProduction + "/" + m_strAliasPageName); } else { m_strAliasPageName = SitePath + m_strAliasPageName; } m_strAliasPageName = "<a href=\"" + m_strAliasPageName + "\" target=\"_blank\" >" + m_strAliasPageName + "</a>"; } else { m_strAliasPageName = " [Not Defined]"; } tdAliasPageName.InnerHtml = m_strAliasPageName; } else { phAliases.Visible = false; phAliases2.Visible = false; } auto_aliaslist = m_autoaliasApi.GetListForContent(content_data.Id); autoAliasList.InnerHtml = "<div class=\"ektronHeader\">" + m_refMsg.GetMessage("lbl automatic") + "</div>"; autoAliasList.InnerHtml += "<div class=\"ektronBorder\">"; autoAliasList.InnerHtml += "<table width=\"100%\">"; autoAliasList.InnerHtml += "<tr class=\"title-header\">"; autoAliasList.InnerHtml += "<th>" + m_refMsg.GetMessage("generic type") + "</th>"; autoAliasList.InnerHtml += "<th>" + m_refMsg.GetMessage("lbl alias name") + "</th>"; autoAliasList.InnerHtml += "</tr>"; for (i = 0; i <= auto_aliaslist.Count() - 1; i++) { autoAliasList.InnerHtml += "<tr class=\"row\">"; if (auto_aliaslist[i].AutoAliasType == Ektron.Cms.Common.EkEnumeration.AutoAliasType.Folder) { autoAliasList.InnerHtml += "<td><img src =\"" + m_refContentApi.AppPath + "images/UI/Icons/folder.png\" alt=\"" + m_refContentApi.EkMsgRef.GetMessage("lbl folder") + "\" title=\"" + m_refContentApi.EkMsgRef.GetMessage("lbl folder") + "\"/ ></td>"; } else { autoAliasList.InnerHtml += "<td><img src =\"" + m_refContentApi.AppPath + "images/UI/Icons/taxonomy.png\" alt=\"" + m_refContentApi.EkMsgRef.GetMessage("generic taxonomy lbl") + "\" title=\"" + m_refContentApi.EkMsgRef.GetMessage("generic taxonomy lbl") + "\"/ ></td>"; } if (IsStagingServer && folder_data.DomainStaging != string.Empty) { autoAliasList.InnerHtml = autoAliasList.InnerHtml + "<td> <a href = \"http://" + folder_data.DomainStaging + "/" + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td></tr>"; } else if (folder_data.IsDomainFolder) { autoAliasList.InnerHtml += "<td> <a href = \"http://" + folder_data.DomainProduction + "/" + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td>"; } else { autoAliasList.InnerHtml += "<td> <a href = \"" + SitePath + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td>"; } autoAliasList.InnerHtml += "</tr>"; } autoAliasList.InnerHtml += "</table>"; autoAliasList.InnerHtml += "</div>"; if (content_data == null) { content_data = m_refContentApi.GetContentById(m_intId, 0); } if (content_data.Type == 3333) { m_refCatalog = new CatalogEntry(m_refContentApi.RequestInformationRef); m_refCurrency = new Currency(m_refContentApi.RequestInformationRef); //m_refMedia = MediaData() entry_edit_data = m_refCatalog.GetItemEdit(m_intId, ContentLanguage, false); Ektron.Cms.Commerce.ProductType m_refProductType = new Ektron.Cms.Commerce.ProductType(m_refContentApi.RequestInformationRef); prod_type_data = m_refProductType.GetItem(entry_edit_data.ProductType.Id, true); if (prod_type_data.Attributes.Count == 0) { phAttributes.Visible = false; phAttributes2.Visible = false; } Display_PropertiesTab(content_data); Display_PricingTab(); Display_ItemTab(); Display_MetadataTab(); Display_MediaTab(); } else { ViewContentProperties(content_data); phCommerce.Visible = false; phCommerce2.Visible = false; phItems.Visible = false; } bool bPackageDisplayXSLT = false; string CurrentXslt = ""; int XsltPntr; if ((!(content_data.XmlConfiguration == null)) && (content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Content || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Forms)) { if (!(content_data.XmlConfiguration == null)) { if (content_data.XmlConfiguration.DefaultXslt.Length > 0) { if (content_data.XmlConfiguration.DefaultXslt == "0") { bPackageDisplayXSLT = true; } else { bPackageDisplayXSLT = false; } if (!bPackageDisplayXSLT) { XsltPntr = int.Parse(content_data.XmlConfiguration.DefaultXslt); if (XsltPntr > 0) { Collection tmpXsltColl = (Collection)content_data.XmlConfiguration.PhysPathComplete; if (tmpXsltColl["Xslt" + XsltPntr] != null) { CurrentXslt = (string)(tmpXsltColl["Xslt" + XsltPntr]); } else { tmpXsltColl = (Collection)content_data.XmlConfiguration.LogicalPathComplete; CurrentXslt = (string)(tmpXsltColl["Xslt" + XsltPntr]); } } } } else { bPackageDisplayXSLT = true; } //End If Ektron.Cms.Xslt.ArgumentList objXsltArgs = new Ektron.Cms.Xslt.ArgumentList(); objXsltArgs.AddParam("mode", string.Empty, "preview"); if (bPackageDisplayXSLT) { divContentHtml.InnerHtml = m_refContentApi.XSLTransform(content_data.Html, content_data.XmlConfiguration.PackageDisplayXslt, false, false, objXsltArgs, true, true); } else { // CurrentXslt is always obtained from the object in the database. divContentHtml.InnerHtml = m_refContentApi.XSLTransform(content_data.Html, CurrentXslt, true, false, objXsltArgs, true, true); } } else { divContentHtml.InnerHtml = content_data.Html; } } else { if (content_data.Type == 104) { media_html.Value = content_data.MediaText; //Get Url from content string tPath = m_refContentApi.RequestInformationRef.AssetPath + m_refContentApi.EkContentRef.GetFolderParentFolderIdRecursive(content_data.FolderId).Replace(",", "/") + "/" + content_data.AssetData.Id + "." + content_data.AssetData.FileExtension; string mediaHTML = FixPath(content_data.Html, tPath); int scriptStartPtr = 0; int scriptEndPtr = 0; int len = 0; //Registering the javascript & CSS this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "linkReg", "<link href=\"" + m_refContentApi.ApplicationPath + "csslib/EktTabs.css\" rel=\"stylesheet\" type=\"text/css\" />", false); mediaHTML = mediaHTML.Replace("<link href=\"" + m_refContentApi.ApplicationPath + "csslib/EktTabs.css\" rel=\"stylesheet\" type=\"text/css\" />", ""); while (1 == 1) { scriptStartPtr = mediaHTML.IndexOf("<script", scriptStartPtr); scriptEndPtr = mediaHTML.IndexOf("</script>", scriptEndPtr); if (scriptStartPtr == -1 || scriptEndPtr == -1) { break; } len = scriptEndPtr - scriptStartPtr + 9; this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), (string)("scriptreg" + scriptEndPtr), mediaHTML.Substring(scriptStartPtr, len), false); mediaHTML = mediaHTML.Replace(mediaHTML.Substring(scriptStartPtr, len), ""); scriptStartPtr = 0; scriptEndPtr = 0; } media_display_html.Value = mediaHTML; divContentHtml.InnerHtml = "<a href=\"#\" onclick=\"document.getElementById(\'" + divContentHtml.ClientID + "\').innerHTML = document.getElementById(\'" + media_display_html.ClientID + "\').value;return false;\" alt=\"" + m_refMsg.GetMessage("alt show media content") + "\" title=\"" + m_refMsg.GetMessage("alt show media content") + "\">" + m_refMsg.GetMessage("lbl show media content") + "<br/><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/filmstrip_ph.jpg\" /></a>"; } else { if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, Convert .ToBoolean (-1))) { string ver = ""; ver = (string)("&version=" + content_data.AssetData.Version); if (IsImage(content_data.AssetData.Version)) { divContentHtml.InnerHtml = "<img src=\"" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + content_data.AssetData.Id + ver + "\" />"; } else { divContentHtml.InnerHtml = "<div align=\"center\" style=\"padding:15px;\"><a style=\"text-decoration:none;\" href=\"#\" onclick=\"javascript:window.open(\'" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + content_data.AssetData.Id + ver + "\',\'DownloadAsset\',\'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=1000,height=800\');return false;\"><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/application/download.gif\" />" + m_refMsg.GetMessage("btn download") + " "" + content_data.Title + ""</a></div>"; } } else if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) { Ektron.Cms.API.UrlAliasing.UrlAliasCommon u = new Ektron.Cms.API.UrlAliasing.UrlAliasCommon(); FolderData fd = this.m_refContentApi.GetFolderById(content_data.FolderId); string stralias = u.GetAliasForContent(content_data.Id); if (stralias == string.Empty || fd.IsDomainFolder) { stralias = content_data.Quicklink; } string link = ""; if (content_data.ContType == (int)EkEnumeration.CMSContentType.Content || (content_data.ContType == (int)EkEnumeration.CMSContentType.Archive_Content && content_data.EndDateAction != 1)) { string url = this.m_refContent.RequestInformation.SitePath + stralias; if (url.Contains("?")) { url += "&"; } else { url += "?"; } if ("viewstaged" == m_strPageAction) { url += "view=staged"; } else { url += "view=published"; } url += (string)("&LangType=" + content_data.LanguageId.ToString()); link = "<a href=\"" + url + "\" onclick=\"window.open(this.href);return false;\">Click here to view the page</a><br/><br/>"; } divContentHtml.InnerHtml = link + Ektron.Cms.PageBuilder.PageData.RendertoString(content_data.Html); } else { if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == content_data.Type || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == content_data.Type) { divContentHtml.InnerHtml = content_data.Html.Replace("[srcpath]", m_refContentApi.ApplicationPath + m_refContentApi.AppeWebPath); divContentHtml.InnerHtml = divContentHtml.InnerHtml.Replace("[skinpath]", m_refContentApi.ApplicationPath + "csslib/ContentDesigner/"); } else { divContentHtml.InnerHtml = content_data.Html; } if (m_bIsBlog) { Collection blogData = m_refContentApi.EkContentRef.GetBlogData(content_data.FolderId); if (blogData != null) { if (blogData["enablecomments"].ToString() != string.Empty) { litBlogComment.Text = "<div class=\"ektronTopSpace\"></div><a class=\"button buttonInline greenHover buttonNoIcon\" href=\"" + m_refContentApi.AppPath + "content.aspx?id=" + content_data.FolderId + "&action=ViewContentByCategory&LangType=" + content_data.LanguageId + "&ContType=" + Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments + "&contentid=" + content_data.Id + "&viewin=" + content_data.LanguageId + "\" title=\"" + m_refMsg.GetMessage("alt view comments label") + "\">" + m_refMsg.GetMessage("view comments") + "</a>"; litBlogComment.Visible = true; } } } } } } sSummaryText = new StringBuilder(); if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == content_data.Type || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == content_data.Type) { if (content_data.Teaser != null) { if (content_data.Teaser.IndexOf("<ektdesignpackage_design") > -1) { string strDesign; strDesign = m_refContentApi.XSLTransform(null, null, true, false, null, true); tdsummarytext.InnerHtml = strDesign; } else { tdsummarytext.InnerHtml = content_data.Teaser; } } else { tdsummarytext.InnerHtml = ""; } } else { if (m_bIsBlog) { sSummaryText.AppendLine("<table class=\"ektronGrid\">"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td valign=\"top\" class=\"label\">"); sSummaryText.AppendLine(" " + m_refMsg.GetMessage("generic description") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td valign=\"top\">"); } sSummaryText.AppendLine(content_data.Teaser); if (m_bIsBlog) { sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td valign=\"top\" class=\"label\">"); sSummaryText.AppendLine(" " + m_refMsg.GetMessage("lbl blog cat") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); if (!(blog_post_data.Categories == null)) { arrBlogPostCategories = blog_post_data.Categories; if (arrBlogPostCategories.Length > 0) { Array.Sort(arrBlogPostCategories); } } else { arrBlogPostCategories = null; } if (blog_post_data.Categories.Length > 0) { for (i = 0; i <= (blog_post_data.Categories.Length - 1); i++) { if (blog_post_data.Categories[i].ToString() != "") { sSummaryText.AppendLine(" <input type=\"checkbox\" name=\"blogcategories" + i.ToString() + "\" value=\"" + blog_post_data.Categories[i].ToString() + "\" checked=\"true\" disabled> " + Strings.Replace((string)(blog_post_data.Categories[i].ToString()), "~@~@~", ";", 1, -1, 0) + "<br />"); } } } else { sSummaryText.AppendLine("No categories defined."); } sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td class=\"label\" valign=\"top\">"); sSummaryText.AppendLine(" " + m_refMsg.GetMessage("lbl personal tags") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); if (!(blog_post_data == null)) { sSummaryText.AppendLine(blog_post_data.Tags); } sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td class=\"label\">"); if (!(blog_post_data == null)) { sSummaryText.AppendLine(" <input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\"" + blog_post_data.TrackBackURLID.ToString() + "\" />"); sSummaryText.AppendLine(" <input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>" + m_refMsg.GetMessage("lbl trackback url") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); sSummaryText.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"" + EkFunctions.HtmlEncode(blog_post_data.TrackBackURL) + "\" disabled/>"); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td class=\"label\">"); if (blog_post_data.Pingback == true) { sSummaryText.AppendLine("" + m_refMsg.GetMessage("lbl blog ae ping") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); sSummaryText.AppendLine(" <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" checked disabled/>"); } else { sSummaryText.AppendLine("" + m_refMsg.GetMessage("lbl blog ae ping") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); sSummaryText.AppendLine(" <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" disabled/>"); } } else { sSummaryText.AppendLine(" <input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\"\" />"); sSummaryText.AppendLine(" <input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>" + m_refMsg.GetMessage("lbl trackback url") + ""); sSummaryText.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"\" disabled/>"); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine(" <tr>"); sSummaryText.AppendLine(" <td class=\"label\">" + m_refMsg.GetMessage("lbl blog ae ping") + ""); sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" <td>"); sSummaryText.AppendLine(" <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" disabled/>"); } sSummaryText.AppendLine(" </td>"); sSummaryText.AppendLine(" </tr>"); sSummaryText.AppendLine("</table>"); } tdsummarytext.InnerHtml = sSummaryText.ToString(); } ViewMetaData(content_data); tdcommenttext.InnerHtml = content_data.Comment; AddTaskTypeDropDown(); ViewTasks(); ViewSubscriptions(); Ektron.Cms.Content.EkContent cref; cref = m_refContentApi.EkContentRef; TaxonomyBaseData[] dat; dat = cref.GetAllFolderTaxonomy(folder_data.Id); if (dat == null || dat.Length == 0) { phCategories.Visible = false; phCategories2.Visible = false; } ViewAssignedTaxonomy(); if ((content_data != null) && ((content_data.Type >= EkConstants.ManagedAsset_Min && content_data.Type <= EkConstants.ManagedAsset_Max && content_data.Type != 104) || (content_data.Type >= EkConstants.Archive_ManagedAsset_Min && content_data.Type <= EkConstants.Archive_ManagedAsset_Max && content_data.Type != 1104) || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)) { showAlert = false; } if ( (Request.QueryString["menuItemType"] != null && Request.QueryString["menuItemType"].ToLower() == "viewproperties") || (Request.QueryString["tab"] != null && Request.QueryString["tab"].ToLower() == "properties") ) { DefaultTab.Value = "dvProperties"; Util_ReloadTree(content_data.Path, content_data.FolderId); } }
public PostController() { _context = new BlogConnnectionDbContext(); blogPostData = new BlogPostData(); }
private void ViewContent() { bool bCanAlias = false; ekrw = m_refAPI.EkUrlRewriteRef; ViewToolBar(); System.Text.StringBuilder result = new System.Text.StringBuilder(); blog_post_data = new BlogPostData(); blog_post_data.Categories = (string[])Array.CreateInstance(typeof(string), 0); foreach ( Collection cApproval in (Collection)m_cCont["ContentMetadata"]) { if (System.Convert.ToInt32(cApproval["ObjectType"]) > 0) { switch (System.Convert.ToInt32(cApproval["ObjectType"])) { case (int)Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Categories: string sTmp = cApproval["MetaText"].ToString(); sTmp = sTmp.Replace("'", "\'"); sTmp = sTmp.Replace(""", "\""); sTmp = sTmp.Replace(">", ">"); sTmp = sTmp.Replace("<", "<"); blog_post_data.Categories = sTmp.Split(';'); break; case (int)Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Ping: if (!(cApproval["MetaText"].ToString().Trim().ToLower() == "no")) { m_bIsBlog = true; } blog_post_data.Pingback = Ektron.Cms.Common.EkFunctions.GetBoolFromYesNo(cApproval["MetaText"].ToString()); break; case (int)Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Tags: blog_post_data.Tags = cApproval["MetaText"].ToString(); break; case (int)Ektron.Cms.Common.EkEnumeration.BlogPostDataType.Trackback: blog_post_data.TrackBackURL = cApproval["MetaText"].ToString(); break; } } } result.Append("<div class=\"tabContainerWrapper\">"); result.Append("<div class=\"tabContainer\"><ul>"); result.Append("<li><a href=\"#dvContent\">" + (m_refMsg.GetMessage("content text")) + "</a></li>"); result.Append("<li><a href=\"#dvSummary\">" + (m_refMsg.GetMessage("Summary text")) + "</a></li>"); if (true == bCanAlias) { result.Append("<li><a href=\"#dvAlias\">" + (m_refMsg.GetMessage("lbl alias")) + "</a></li>"); } result.Append("<li><a href=\"#dvMetadata\">" + (m_refMsg.GetMessage("metadata text")) + "</a></li>"); result.Append("<li><a href=\"#dvProperties\">" + (m_refMsg.GetMessage("properties text")) + "</a></li>"); result.Append("<li><a href=\"#dvComment\">" + (m_refMsg.GetMessage("comment text")) + "</a></li>"); //Taxonomy result.Append("<li><a href=\"#dvTaxonomy\">" + (m_refMsg.GetMessage("viewtaxonomytabtitle")) + "</a></li>"); result.Append("</ul>"); result.Append("<div id=\"dvProperties\">"); result.Append("<table class=\"ektronGrid\">"); result.Append("<tr>"); result.Append("<td class=\"label\">" + (m_refMsg.GetMessage("content title label")) + "</td>"); result.Append("<td>" + m_cCont["ContentTitle"] + "</td>"); result.Append("</tr>"); result.Append("<tr>"); result.Append("<td class=\"label\">" + (m_refMsg.GetMessage("content id label")) + "</td>"); result.Append("<td>" + (m_cCont["ContentID"]) + "</td>"); result.Append("</tr>"); result.Append("<tr>"); result.Append("<td class=\"label\">" + (m_refMsg.GetMessage("content status label")) + "</td>"); result.Append("<td>"); if (m_cCont["ContentStatus"].ToString() == "S") { result.Append(m_refMsg.GetMessage("status:Submitted for Approval")); } else { result.Append(m_refMsg.GetMessage("status:Submitted for Deletion")); } result.Append("</td>"); result.Append("</tr>"); result.Append("<tr>"); result.Append("<td class=\"label\">" + m_refMsg.GetMessage("submitted by label") + "</td>"); result.Append("<td>"); result.Append(m_cCont["EditorLName"] + ", " + m_cCont["EditorFName"]); result.Append("</td>"); result.Append("</tr>"); result.Append("<tr>"); result.Append("<td class=\"label\">" + m_refMsg.GetMessage("content LED label") + "</td>"); result.Append("<td>" + m_cCont["DisplayLastEditDate"] + "</td>"); result.Append("</tr>"); result.Append("<tr>"); result.Append("<td class=\"label\">" + m_refMsg.GetMessage("generic start date label") + "</td>"); result.Append("<td>"); if (m_cCont["DisplayGoLive"].ToString() != "") { result.Append(m_cCont["DisplayGoLive"]); } else { result.Append(m_refMsg.GetMessage("none specified msg")); } result.Append("</td>"); result.Append("</tr>"); result.Append("<tr>"); result.Append("<td class=\"label\">" + m_refMsg.GetMessage("generic end date label") + "</td>"); result.Append("<td>"); if (m_cCont["DisplayEndDate"].ToString() != "") { result.Append(m_cCont["DisplayEndDate"]); } else { result.Append(m_refMsg.GetMessage("none specified msg")); } result.Append("</td>"); result.Append("</tr>"); result.Append("<tr>"); result.Append("<td class=\"label\">" + (m_refMsg.GetMessage("content DC label")) + "</td>"); result.Append("<td>" + (m_cCont["DisplayDateCreated"]) + "</td>"); result.Append("</tr>"); result.Append("<tr>"); result.Append("<td class=\"label\">" + (m_refMsg.GetMessage("content approvals label")) + "</td>"); result.Append("<td>"); if (cApprovals.Count > 0) { foreach (Collection cApproval in cApprovals) { if (cApproval["ApproverType"].ToString().ToLower() == "user") { result.Append("<img class=\"imgUsers\" src=\"" + m_refAPI.AppPath + "images/UI/Icons/user.png\" align=\"absbottom\" alt=\"" + m_refMsg.GetMessage("approver is user") + "\" title=\"" + m_refMsg.GetMessage("approver is user") + "\"/>"); } else { result.Append("<img class=\"imgUsers\" src=\"" + m_refAPI.AppPath + "images/UI/Icons/users.png\" align=\"absbottom\" alt=\"" + m_refMsg.GetMessage("approver is user group") + "\" title=\"" + m_refMsg.GetMessage("approver is user group") + "\"/>"); } if (Convert.ToBoolean(cApproval["CurrentApprover"])) { result.Append("<font color=\"\"red\"\">"); } else { result.Append(" <font> "); } result.Append(cApproval["Name"]); } } else { result.Append(m_refMsg.GetMessage("none specified msg")); } result.Append("</td>"); result.Append("</tr>"); result.Append("</table>"); result.Append("</div>"); result.Append("<div id=\"dvMetadata\">"); result.Append("<table class=\"ektronGrid\">"); foreach (Collection cApproval in (Collection)m_cCont["ContentMetadata"]) { if (!(System.Convert.ToInt32(cApproval["ObjectType"]) > 0)) { result.Append("<tr>"); result.Append("<td class=\"label\">" + (cApproval["MetaTypeName"]) + ":</td>"); result.Append("<td>" + (cApproval["MetaText"]) + "</td>"); result.Append("</tr>"); } } result.Append("</table>"); result.Append("</div>"); if (true == bCanAlias) { string m_strAliasPageName = string.Empty; if (Request.QueryString["content"] == "published") { //Do nothing } else { m_strAliasPageName = m_cCont["ManualAlias"].ToString(); } if (m_strAliasPageName != "") { m_strAliasPageName = SitePath + m_strAliasPageName; } else { m_strAliasPageName = " [Not Defined]"; } result.Append("<DIV id=\"dvAlias\""); result.Append(" <TABLE class=\"ektronGrid\">"); result.Append("<TR>"); result.Append("<TD class=\"label\">" + m_refMsg.GetMessage("lbl aliased page") + ":\"</TD>"); result.Append("<TD>" + m_strAliasPageName + "</TD>"); result.Append("</TR>"); result.Append("</TABLE>"); result.Append("</DIV>"); } result.Append("<div id=\"dvSummary\">"); result.Append("<table class=\"ektronGrid\">"); result.Append("<tr>"); string strTeaser; int nContentType; strTeaser = m_cCont["ContentTeaser"].ToString(); if (Information.IsNumeric(m_cCont["ContentType"])) { nContentType = System.Convert.ToInt32(m_cCont["ContentType"]); } else { nContentType = (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Content; // default } if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == nContentType || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == nContentType) { if (strTeaser != null) { if (strTeaser.IndexOf("<ektdesignpackage_design") > -1) { string strDesign; strDesign = m_refAPI.XSLTransform("", "", true, false, null, true); strTeaser = strDesign; } } else { strTeaser = ""; } } result.Append("<td class=\"label\">"); result.Append(m_refMsg.GetMessage("lbl teaser")); result.Append(":</td><td>"); result.Append(strTeaser); result.Append("</td></tr>"); if (m_bIsBlog) { result.Append("<tr><td class=\"label\">"); result.Append(m_refMsg.GetMessage("lbl tags")); result.Append(":</td><td>"); if (!(blog_post_data == null)) { result.AppendLine(blog_post_data.Tags); } result.AppendLine("</td></tr>"); result.Append("<tr><td class=\"label\">"); result.Append(m_refMsg.GetMessage("categories text")); result.Append(":</td><td>"); if (!(blog_post_data.Categories == null)) { arrBlogPostCategories = blog_post_data.Categories; if (arrBlogPostCategories.Length > 0) { Array.Sort(arrBlogPostCategories); } } else { arrBlogPostCategories = null; } if (blog_post_data.Categories.Length > 0) { for (i = 0; i <= (blog_post_data.Categories.Length - 1); i++) { if (blog_post_data.Categories[i].ToString() != "") { result.AppendLine(" <input type=\"checkbox\" name=\"blogcategories" + i.ToString() + "\" value=\"" + blog_post_data.Categories[i].ToString() + "\" checked=\"true\" disabled> " + Strings.Replace((string)(blog_post_data.Categories[i].ToString()), "~@~@~", ";", 1, -1, 0) + "<br>"); } } } else { result.AppendLine("No categories defined."); } result.Append("</td></tr>"); result.Append("<tr><td class=\"label\">"); result.Append(m_refMsg.GetMessage("lbl trackback url")); result.Append(":</td><td>"); result.AppendLine("<input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\""); if (!(blog_post_data == null)) { result.Append(blog_post_data.TrackBackURLID.ToString()); } result.Append("\" /><input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>"); if (!(blog_post_data == null)) { result.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"" + EkFunctions.HtmlEncode(blog_post_data.TrackBackURL) + "\" disabled/>"); } result.Append("<tr><td class=\"label\">"); result.Append(m_refMsg.GetMessage("lbl blog ae ping")); result.Append(":</td><td>"); result.Append("<input type=\"checkbox\" name=\"pingback\" id=\"pingback\" "); if (!(blog_post_data == null)) { if (blog_post_data.Pingback == true) { result.Append("checked "); } } result.Append(" disabled/>"); result.AppendLine("</td>"); result.AppendLine("</tr>"); result.AppendLine("</table>"); } result.Append(" </td>"); result.Append("</tr>"); result.Append("</table>"); result.Append("</div>"); result.Append("<div id=\"dvComment\">"); result.Append("<table class=\"ektronGrid\">"); result.Append("<tr>"); result.Append("<td class=\"label\">" + (m_refMsg.GetMessage("content HC label")) + "</td>"); result.Append("<td>" + (m_cCont["Comment"]) + "</td>"); result.Append("</tr>"); result.Append("</table>"); result.Append("</div>"); //Taxonomy result.Append("<div id=\"dvTaxonomy\">"); result.Append("<table class=\"ektronGrid\">"); result.Append("<tr><td class=\"label\">Assigned Taxonomy/Category:</td><td><table>"); TaxonomyBaseData[] taxonomy_cat_arr = null; taxonomy_cat_arr = m_refContent.ReadAllAssignedCategory(aprId); if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0) { foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr) { result.Append("<tr>"); result.Append("<td><li>" + taxonomy_cat.TaxonomyPath.Remove(0, 1).Replace("\\", " > ") + "</li></td>"); result.Append("</tr>"); } } else { result.Append("<tr><td> </td><td>No categories selected.</td></tr>"); } result.Append("</table></td></tr></table>"); result.Append("</div>"); result.Append("<div id=\"dvContent\">"); bool bPackageDisplayXSLT; string CurrentXslt; bPackageDisplayXSLT = false; CurrentXslt = ""; if (m_cCont["XmlConfiguration"] != null && ((Collection)m_cCont["XmlConfiguration"]).Count > 0 ) { //check to see if there is alread a defualt display XSLT Collection tmpXmlColl = (Collection)m_cCont["XmlConfiguration"]; if (tmpXmlColl["PackageDisplayXslt"] != null) { bPackageDisplayXSLT = true; } else { if (tmpXmlColl["DefaultXslt"] != null) { bPackageDisplayXSLT = false; Collection tmpXsltColl = (Collection)tmpXmlColl["PhysPathComplete"]; if (tmpXsltColl["Xslt" + tmpXmlColl["DefaultXslt"]] != null) { CurrentXslt = (string)(tmpXsltColl["Xslt" + tmpXmlColl["DefaultXslt"]]); } else { CurrentXslt = (string)(tmpXsltColl["Xslt" + tmpXmlColl["DefaultXslt"]]); } } else { bPackageDisplayXSLT = true; } } if (bPackageDisplayXSLT) { result.Append(m_refAPI.XSLTransform(m_cCont["ContentHtml"].ToString(), (string)(tmpXmlColl["PackageDisplayXslt"]), false, false, null, false, true)); } else { result.Append(m_refAPI.TransformXSLT(m_cCont["ContentHTML"].ToString(), CurrentXslt)); } } else { //----- Defect #28122 - Content tab is blank when viewing dms asset from View Approval Report screen. //----- Only contentHtml was being added to the content tab div. Int he case of an asset, it must be //----- downloaded. if (Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64(m_cCont["ContentType"]), true)) { if ((string)m_cCont["ContentStatus"] != "A" && Convert.ToString(Request.QueryString["action"]).ToLower().Trim() == "view") { result.Append("<iframe width=\"100%\" height=\"100%\" src=\"" + m_refContentApi.GetViewUrl(m_cCont["AssetID"].ToString(), Convert.ToInt32(m_cCont["ContentType"])) + "\"></iframe>"); } else { string ver = ""; ver = (string)("&version=" + m_cCont["AssetVersion"]); result.Append("<div align=\"center\" style=\"padding:15px;\"><a style=\"text-decoration:none;\" href=\"#\" onclick=\"javascript:window.open(\'" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + m_cCont["AssetID"] + ver + "\',\'DownloadAsset\',\'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=1000,height=800\');return false;\"><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/application/download.gif\" />" + m_refMsg.GetMessage("btn download") + " "" + m_cCont["ContentTitle"] + ""</a></div>"); } } else { if (Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData == (EkEnumeration.CMSContentSubtype)m_cCont["ContentSubType"]) { result.Append(Ektron.Cms.PageBuilder.PageData.RendertoString(m_cCont["ContentHTML"].ToString())); } else { result.Append(m_cCont["ContentHTML"]); } } } result.Append("</div>"); result.Append("</div>"); //tabContainer result.Append("</div>"); //tabContainerWrapper litViewContent.Text = result.ToString(); }
private void Display_EditControls() { int intContentLanguage = 1033; PermissionData security_lib_data; int i = 0; bool bEphoxSupport = false; string aliasContentType = string.Empty; folder_data = null; try { netscape.Value = ""; language_data = m_refSiteApi.GetLanguageById(m_intContentLanguage); ImagePath = language_data.ImagePath; BrowserCode = language_data.BrowserCode; for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++) { asset_info.Add(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i], ""); } Page.ClientScript.RegisterHiddenField("TaxonomyOverrideId", Convert.ToString(TaxonomyOverrideId)); if (IsMac && m_SelectedEditControl != "ContentDesigner" && m_strType == "update") { //We do not support XML content and Form. Check if the content is XML or form and if it is then don't proceed further. ContentData cData; cData = m_refContApi.GetContentById(m_intItemId, 0); if ((cData.Type == 2) || ((cData.XmlConfiguration != null) && (cData.XmlConfiguration.PackageXslt.Length > 0))) { bEphoxSupport = false; } else { bEphoxSupport = true; } if (!bEphoxSupport) { //Show not supported message throw (new Exception("Forms and XML Editing is not supported on MAC.")); } } if ((Request.QueryString["pullapproval"] == "true") && (m_strType == "update")) { ret = m_refContent.TakeOwnership(m_intItemId); } var2 = m_refContent.GetEditorVariablev2_0(m_intItemId, m_strType); //TODO:Verify info param via var1 removed security_data = m_refContApi.LoadPermissions(m_intItemId, "content", 0); endDateActionSel = GetEndDateActionStrings(); endDateActionSize = Convert.ToInt32(endDateActionSel["SelectionSize"]); if (security_data != null) { IsAdmin = security_data.IsAdmin; } active_subscription_list = m_refContApi.GetAllActiveSubscriptions(); settings_data = m_refSiteApi.GetSiteVariables(CurrentUserID); if (m_strType == "update") { content_edit_data = m_refContApi.GetContentForEditing(m_intItemId); UserRights = m_refContApi.LoadPermissions(m_intItemId, "content", ContentAPI.PermissionResultType.Content); lContentType = content_edit_data.Type; lContentSubType = content_edit_data.SubType; if (content_edit_data.Type == 2 || 4 == content_edit_data.Type) { bIsFormDesign = true; m_intContentType = 2; } if (!(content_edit_data == null)) { security_lib_data = m_refContApi.LoadPermissions(content_edit_data.FolderId, "folder", 0); UploadPrivs = security_lib_data.CanAddToFileLib || security_lib_data.CanAddToImageLib; m_strContentTitle = Server.HtmlDecode(content_edit_data.Title); m_strAssetFileName = content_edit_data.AssetData.FileName; m_strContentHtml = content_edit_data.Html; content_teaser = content_edit_data.Teaser; meta_data = content_edit_data.MetaData; content_comment = Server.HtmlDecode(content_edit_data.Comment); content_stylesheet = content_edit_data.StyleSheet; m_intContentFolder = content_edit_data.FolderId; m_intTaxFolderId = content_edit_data.FolderId; intContentLanguage = content_edit_data.LanguageId; go_live = content_edit_data.GoLive; end_date = content_edit_data.EndDate; end_date_action = content_edit_data.EndDateAction.ToString(); intInheritFrom = m_refContent.GetFolderInheritedFrom(m_intContentFolder); subscription_data_list = m_refContApi.GetSubscriptionsForFolder(intInheritFrom); subscription_properties_list = m_refContApi.GetSubscriptionPropertiesForContent(m_refContentId); //first try content if (subscription_properties_list == null) { subscription_properties_list = m_refContApi.GetSubscriptionPropertiesForFolder(intInheritFrom); //then get folder subscribed_data_list = subscription_data_list; } else //content is populated. { subscribed_data_list = m_refContApi.GetSubscriptionsForContent(m_refContentId); // get subs for folder } if (!(meta_data == null)) { MetaDataNumber = meta_data.Length; } PreviousState = content_edit_data.CurrentStatus; iMaxContLength = content_edit_data.MaxContentSize; iMaxSummLength = content_edit_data.MaxSummarySize; path = content_edit_data.Path; m_intManualAliasId = content_edit_data.ManualAliasId; folder_data = m_refContApi.GetFolderById(m_intContentFolder); if ((path.Substring(path.Length - 1, 1) == "\\")) { path = path.Substring(path.Length -(path.Length - 1)); } //Check to see if this belongs to XML configuration if (lContentType != 2) { xmlconfig_data = content_edit_data.XmlConfiguration; if (!(xmlconfig_data == null)) { editorPackage = xmlconfig_data.PackageXslt; MultiTemplateID.Text = "<input type=\"hidden\" name=\"xid\" value=\"" + content_edit_data.XmlConfiguration.Id.ToString() + "\">"; if (editorPackage.Length > 0) { bVer4Editor = true; // this means that we will be using the new Package Design for the content } } } if (m_strContentTitle != "") { MetaComplete = UserRights.CanMetadataComplete; //Changed from 1 to true } asset_info["AssetID"] = content_edit_data.AssetData.Id; asset_info["AssetVersion"] = content_edit_data.AssetData.Version; asset_info["MimeType"] = content_edit_data.AssetData.MimeType; asset_info["FileExtension"] = content_edit_data.AssetData.FileExtension; } validTypes.Value = Convert.ToString(asset_info["FileExtension"]); } else { UserRights = m_refContApi.LoadPermissions(m_intItemId, "folder", ContentAPI.PermissionResultType.Folder); folder_data = m_refContApi.GetFolderById(m_intItemId); MetaComplete = UserRights.CanMetadataComplete; if (m_intXmlConfigId > -1) { xmlconfig_data = m_refContApi.GetXmlConfiguration(m_intXmlConfigId); MultiTemplateID.Text = "<input type=\"hidden\" name=\"xid\" value=\"" + m_intXmlConfigId.ToString() + "\">"; } else { if ((folder_data.XmlConfiguration != null) && (folder_data.XmlConfiguration.Length > 0) && (Request.QueryString["AllowHTML"] != "1")) { xmlconfig_data = folder_data.XmlConfiguration[0]; } else { xmlconfig_data = null; } } if (!(xmlconfig_data == null)) { editorPackage = xmlconfig_data.PackageXslt; if (editorPackage.Length > 0) { bVer4Editor = true; } } content_stylesheet = m_refContApi.GetStyleSheetByFolderID(m_intItemId); security_lib_data = m_refContApi.LoadPermissions(m_intItemId, "folder", 0); UploadPrivs = security_lib_data.CanAddToFileLib || security_lib_data.CanAddToImageLib; string TmpId = Request.QueryString["content_id"]; if (!String.IsNullOrEmpty(TmpId)) { //translating asset if (Request.QueryString["type"] == "add") { if (!String.IsNullOrEmpty(Request.QueryString["back_LangType"])) { m_refContApi.ContentLanguage = Convert.ToInt32(Request.QueryString["back_LangType"]); } else { m_refContApi.ContentLanguage = System.Convert.ToInt32(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"]); } } content_data = m_refContApi.GetContentById(Convert.ToInt64(TmpId), 0); if (content_data != null) { if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent) { isOfficeDoc.Value = "true"; } if (m_intXmlConfigId == -1) { if (content_data.XmlConfiguration != null) { m_intXmlConfigId = content_data.XmlConfiguration.Id; xmlconfig_data = content_data.XmlConfiguration; editorPackage = xmlconfig_data.PackageXslt; if (editorPackage.Length > 0) { bVer4Editor = true; } MultiTemplateID.Text = "<input type=\"hidden\" name=\"xid\" value=\"" + m_intXmlConfigId.ToString() + "\">"; } } m_strContentTitle = Server.HtmlDecode(content_data.Title); m_strAssetFileName = content_data.AssetData.FileName; m_strContentHtml = content_data.Html; content_teaser = content_data.Teaser; content_comment = Server.HtmlDecode(content_data.Comment); go_live = content_data.GoLive; end_date = content_data.EndDate; end_date_action = content_data.EndDateAction.ToString(); lContentType = content_data.Type; lContentSubType = content_data.SubType; if (m_strType == "add") { if (Utilities.IsAssetType(lContentType)) { m_strContentTitle = Server.HtmlDecode(content_data.Title); validTypes.Value = content_data.AssetData.FileExtension; } } else { asset_info["AssetID"] = content_data.AssetData.Id; asset_info["AssetVersion"] = content_data.AssetData.Version; asset_info["AssetFilename"] = content_data.AssetData.FileName; asset_info["MimeType"] = content_data.AssetData.MimeType; asset_info["FileExtension"] = content_data.AssetData.FileExtension; asset_info["MimeName"] = content_data.AssetData.MimeName; asset_info["ImageUrl"] = content_data.AssetData.ImageUrl; if (Convert.ToString(asset_info["MimeType"]) == "application/x-shockwave-flash") { asset_info["MediaAsset"] = true; } else { asset_info["MediaAsset"] = false; } validTypes.Value = Convert.ToString(asset_info["FileExtension"]); //Next } } } else { //Adding new file List<string> fileTypeCol = new List<string>(DocumentManagerData.Instance.FileTypes.Split(",".ToCharArray())); string allTypes = ""; foreach (string type in fileTypeCol) { if (allTypes.Length > 0) { allTypes += (string)("," + type.Trim().Replace("*.", "")); } else { allTypes += type.Trim().Replace("*.", ""); } } validTypes.Value = allTypes; } m_intContentFolder = m_intItemId; intInheritFrom = m_refContent.GetFolderInheritedFrom(m_intContentFolder); subscription_data_list = m_refContApi.GetSubscriptionsForFolder(intInheritFrom); //AGofPA get subs for folder; set break inheritance flag false subscription_properties_list = m_refContApi.GetSubscriptionPropertiesForFolder(intInheritFrom); //get folder properties subscribed_data_list = subscription_data_list; //get subs for folder intContentLanguage = m_intContentLanguage; m_refContApi.ContentLanguage = m_intContentLanguage; meta_data = m_refContApi.GetMetaDataTypes("id"); path = m_refContApi.GetPathByFolderID(m_intContentFolder); if ((path.Substring(path.Length - 1, 1) == "\\")) { path = path.Substring(path.Length - (path.Length - 1)); } iMaxContLength = int.Parse(settings_data.MaxContentSize); iMaxSummLength = int.Parse(settings_data.MaxSummarySize); } if (folder_data.FolderType == 1) { m_bIsBlog = true; blog_data = m_refContApi.BlogObject(folder_data); if (m_strType == "update") { blog_post_data = m_refContApi.GetBlogPostData(m_intItemId); } else if (m_strType == "add" && m_refContentId > 0) // add new lang { blog_post_data = m_refContApi.EkContentRef.GetBlogPostDataOnly(m_refContentId, back_LangType); } else { blog_post_data = m_refContApi.GetBlankBlogPostData(); } } if (xmlconfig_data != null) { Collection collXmlConfigData = (Collection)xmlconfig_data.LogicalPathComplete; if (bVer4Editor == false) //only do this if we are using the old method { urlxml = "?Edit_xslt="; if (xmlconfig_data.EditXslt.Length > 0) { urlxml = urlxml + EkFunctions.UrlEncode(Convert.ToString(collXmlConfigData["EditXslt"])); if (m_strContentHtml.Trim().Length == 0) { m_strContentHtml = "<root> </root>"; } } urlxml = urlxml + "&Save_xslt="; if (xmlconfig_data.SaveXslt.Length > 0) { save_xslt_file = Convert.ToString(collXmlConfigData["SaveXslt"]); urlxml = urlxml + EkFunctions.UrlEncode(save_xslt_file); } urlxml = urlxml + "&Schema="; if (xmlconfig_data.XmlSchema.Length > 0) { m_strSchemaFile = Convert.ToString(collXmlConfigData["XmlSchema"]); urlxml = urlxml + EkFunctions.UrlEncode(m_strSchemaFile); } xml_config = AppeWebPath + "cms_xmlconfig.aspx" + urlxml; if (xmlconfig_data.XmlAdvConfig.Length > 0) { xml_config = Convert.ToString(collXmlConfigData["XmlAdvConfig"] + urlxml); } m_strSchemaFile = Convert.ToString(collXmlConfigData["XmlSchema"]); m_strNamespaceFile = Convert.ToString(collXmlConfigData["XmlNameSpace"]); } } //DHTML RENDERING //ASSET CONFIG for (i = 0; i <= Ektron.Cms.Common.EkConstants.m_AssetInfoKeys.Length - 1; i++) { AssetHidden.Text += "<input type=\"hidden\" name=\"asset_" + Strings.LCase(Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]) + "\" value=\"" + EkFunctions.HtmlEncode(asset_info[Ektron.Cms.Common.EkConstants.m_AssetInfoKeys[i]].ToString()) + "\">"; } content_type.Value = Convert.ToString(lContentType); content_subtype.Value = Convert.ToString(lContentSubType); if (m_SelectedEditControl != "ContentDesigner") { jsEditorScripts.Text = Utilities.EditorScripts(var2, AppeWebPath, BrowserCode); } AutoNav.Text = path.Replace("\\", "\\\\"); invalidFormatMsg.Text = m_refMsg.GetMessage("js: invalid date format error msg"); invalidYearMsg.Text = m_refMsg.GetMessage("js: invalid year error msg"); invalidMonthMsg.Text = m_refMsg.GetMessage("js: invalid month error msg"); invalidDayMsg.Text = m_refMsg.GetMessage("js: invalid day error msg"); invalidTimeMsg.Text = m_refMsg.GetMessage("js: invalid time error msg"); if (MetaComplete) { ecmMetaComplete.Text = "1"; } else { ecmMetaComplete.Text = "0"; } ecmMonths.Text = ""; jsNullContent.Text = m_refMsg.GetMessage("null content warning msg"); jsEDWarning.Text = m_refMsg.GetMessage("js: earlier end date warning"); jsMetaCompleteWarning.Text = m_refMsg.GetMessage("js: alert cannot submit meta incomplete") + "\\n" + m_refMsg.GetMessage("js: alert save or checkin or complete meta"); jsSetActionFunction.Text = SetActionClientScript(folder_data.PublishHtmlActive, (xmlconfig_data != null && 1 == lContentType)); jsSitePath.Text = m_refContApi.SitePath; jsEditProLocale.Text = AppeWebPath + "locale" + AppLocaleString + "b.xml"; ValidateContentPanel.Text = " var errReason = 0;" + "\r\n"; ValidateContentPanel.Text += "var errReasonT = 0;" + "\r\n"; ValidateContentPanel.Text += "var errAccess = false;" + "\r\n"; ValidateContentPanel.Text += "var errMessage = \"\";" + "\r\n"; ValidateContentPanel.Text += "var sInvalidContent = \"Continue saving invalid document?\";" + "\r\n"; if (m_SelectedEditControl != "ContentDesigner") { ValidateContentPanel.Text += "if (eWebEditProMessages) {" + "\r\n"; ValidateContentPanel.Text += " sInvalidContent = eWebEditProMessages.invalidContent;" + "\r\n"; ValidateContentPanel.Text += "}" + "\r\n"; } ValidateContentPanel.Text += "var errContent = \"" + m_refMsg.GetMessage("js: alert invalid data") + "\";" + "\r\n"; ValidateContentPanel.Text += "var objValidateInstance = null;" + "\r\n"; if (m_SelectedEditControl != "ContentDesigner") { ValidateContentPanel.Text += "objValidateInstance = eWebEditPro.instances[\"content_html\"];" + "\r\n"; ValidateContentPanel.Text += "if (objValidateInstance){" + "\r\n"; ValidateContentPanel.Text += " if (!eWebEditPro.instances[\"content_html\"].validateContent()) {" + "\r\n"; ValidateContentPanel.Text += " errReason = objValidateInstance.event.reason;" + "\r\n"; ValidateContentPanel.Text += " if (-1001 == errReason || -1002 == errReason || 1003 == errReason || -1003 == errReason) {" + "\r\n"; ValidateContentPanel.Text += " errAccess = true;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += "}" + "\r\n"; } else { ValidateContentPanel.Text += " if (\"object\" == typeof Ektron && Ektron.ContentDesigner && Ektron.ContentDesigner.instances) {" + "\r\n"; ValidateContentPanel.Text += " var objContentEditor = Ektron.ContentDesigner.instances[\"content_html\"];" + "\r\n"; ValidateContentPanel.Text += " if (objContentEditor && \"function\" == typeof objContentEditor.validateContent) {" + "\r\n"; ValidateContentPanel.Text += " errMessage = objContentEditor.validateContent();" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " if (errMessage != null && errMessage != \"\") {" + "\r\n"; ValidateContentPanel.Text += " if (\"object\" == typeof errMessage && \"undefined\" == typeof errMessage.code) {" + "\r\n"; ValidateContentPanel.Text += " alert(errMessage.join(\"\\n\\n\\n\"));" + "\r\n"; ValidateContentPanel.Text += " return false;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " else if (\"object\" == typeof errMessage && \"string\" == typeof errMessage.msg) {" + "\r\n"; ValidateContentPanel.Text += " errReason = errMessage.code;" + "\r\n"; ValidateContentPanel.Text += " errAccess = true;" + "\r\n"; ValidateContentPanel.Text += " alert(\"Content is invalid.\" + \"\\n\\n\" + errMessage.msg);" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " else if (\"string\" == typeof errMessage && errMessage.length > 0) {" + "\r\n"; ValidateContentPanel.Text += " alert(errMessage);" + "\r\n"; ValidateContentPanel.Text += " return false;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; } ValidateContentPanel.Text += "var objTeaserInstance = null;" + "\r\n"; if (m_SelectedEditControl != "ContentDesigner") { ValidateContentPanel.Text += "objTeaserInstance = eWebEditPro.instances[\"content_teaser\"];" + "\r\n"; ValidateContentPanel.Text += "if (objTeaserInstance){" + "\r\n"; ValidateContentPanel.Text += " if (!objTeaserInstance.validateContent()) {" + "\r\n"; ValidateContentPanel.Text += " errReasonT = objTeaserInstance.event.reason;" + "\r\n"; ValidateContentPanel.Text += " if (-1001 == errReasonT || -1002 == errReasonT || 1003 == errReasonT || -1003 == errReasonT) {" + "\r\n"; ValidateContentPanel.Text += " errAccess = true;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += "}" + "\r\n"; } else { ValidateContentPanel.Text += " if (\"object\" == typeof Ektron && Ektron.ContentDesigner && Ektron.ContentDesigner.instances && (\"\" == errMessage || null == errMessage)) {" + "\r\n"; ValidateContentPanel.Text += " var teaserName = \"content_teaser\";" + "\r\n"; ValidateContentPanel.Text += " if (document.forms[0].response) {" + "\r\n"; ValidateContentPanel.Text += " var iTeaser = 0;" + "\r\n"; ValidateContentPanel.Text += " for (var i = 0; i < document.forms[0].response.length; i++) {" + "\r\n"; ValidateContentPanel.Text += " if (document.forms[0].response[i].checked) {" + "\r\n"; ValidateContentPanel.Text += " iTeaser = i;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " switch (iTeaser) {" + "\r\n"; ValidateContentPanel.Text += " case 2: " + "\r\n"; ValidateContentPanel.Text += " teaserName = \"forms_transfer\";" + "\r\n"; ValidateContentPanel.Text += " break;" + "\r\n"; ValidateContentPanel.Text += " case 1:" + "\r\n"; ValidateContentPanel.Text += " teaserName = \"forms_redirect\";" + "\r\n"; ValidateContentPanel.Text += " break;" + "\r\n"; ValidateContentPanel.Text += " case 0:" + "\r\n"; ValidateContentPanel.Text += " default:" + "\r\n"; ValidateContentPanel.Text += " teaserName = \"content_teaser\";" + "\r\n"; ValidateContentPanel.Text += " break;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " var objTeaserEditor = Ektron.ContentDesigner.instances[teaserName];" + "\r\n"; ValidateContentPanel.Text += " if (objTeaserEditor && \"function\" == typeof objTeaserEditor.validateContent){" + "\r\n"; ValidateContentPanel.Text += " errMessage = objTeaserEditor.validateContent();" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " if (errMessage != null && errMessage != \"\") {" + "\r\n"; ValidateContentPanel.Text += " if (\"object\" == typeof errMessage && \"undefined\" == typeof errMessage.code) {" + "\r\n"; ValidateContentPanel.Text += " alert(errMessage.join(\"\\n\\n\\n\"));" + "\r\n"; ValidateContentPanel.Text += " return false;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " else if (\"object\" == typeof errMessage && \"string\" == typeof errMessage.msg) {" + "\r\n"; ValidateContentPanel.Text += " errReason = errMessage.code;" + "\r\n"; ValidateContentPanel.Text += " errAccess = true;" + "\r\n"; ValidateContentPanel.Text += " alert(\"Content is invalid.\" + \"\\n\\n\" + errMessage.msg);" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " else if (\"string\" == typeof errMessage && errMessage.length > 0) {" + "\r\n"; ValidateContentPanel.Text += " alert(errMessage);" + "\r\n"; ValidateContentPanel.Text += " return false;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; } ValidateContentPanel.Text += "if (errReason != 0 || errReasonT != 0) {" + "\r\n"; ValidateContentPanel.Text += " if (errReasonT != 0 && typeof objTeaserInstance != \"undefined\" && objTeaserInstance) {" + "\r\n"; ValidateContentPanel.Text += " errMessage = objTeaserInstance.event.message + \"\";" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " if (errReason != 0 && typeof objValidateInstance != \"undefined\" && objValidateInstance) {" + "\r\n"; ValidateContentPanel.Text += " errMessage = objValidateInstance.event.message + \"\";" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " if (false == errAccess) {" + "\r\n"; ValidateContentPanel.Text += " alert(errContent + \"\\n\" + errMessage);" + "\r\n"; ValidateContentPanel.Text += " $ektron(document).trigger(\"wizardPanelShown\");" + "\r\n"; ValidateContentPanel.Text += " return false;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " else {" + "\r\n"; if ("2" == settings_data.Accessibility) { ValidateContentPanel.Text += " if (typeof Button != \"undefined\") {" + "\r\n"; ValidateContentPanel.Text += " if (\"publish\" == Button.toLowerCase() || \"submit\" == Button.toLowerCase()) {" + "\r\n"; ValidateContentPanel.Text += " alert(errContent);" + "\r\n"; ValidateContentPanel.Text += " $ektron(document).trigger(\"wizardPanelShown\");" + "\r\n"; ValidateContentPanel.Text += " return false;" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " else { " + "\r\n"; ValidateContentPanel.Text += " if (confirm(errContent + \"\\n\" + sInvalidContent)) {" + "\r\n"; ValidateContentPanel.Text += " return true;" + "\r\n"; ValidateContentPanel.Text += " } " + "\r\n"; ValidateContentPanel.Text += " else {" + "\r\n"; ValidateContentPanel.Text += " $ektron(document).trigger(\"wizardPanelShown\");" + "\r\n"; ValidateContentPanel.Text += " return false;" + "\r\n"; ValidateContentPanel.Text += " } " + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += " }" + "\r\n"; } else if ("1" == settings_data.Accessibility) { ValidateContentPanel.Text += " if (confirm(errContent + \"\\n\" + sInvalidContent)) {" + "\r\n"; ValidateContentPanel.Text += " return true;" + "\r\n"; ValidateContentPanel.Text += " } " + "\r\n"; ValidateContentPanel.Text += " else {$ektron(document).trigger(\"wizardPanelShown\"); return false;} " + "\r\n"; } ValidateContentPanel.Text += " }" + "\r\n"; ValidateContentPanel.Text += "}" + "\r\n"; //Change the action page FormAction = (string)("edit.aspx?close=" + Request.QueryString["close"] + "&LangType=" + m_intContentLanguage + "&content_id=" + m_refContentId + (this.TaxonomyOverrideId > 0 ? ("&TaxonomyId=" + this.TaxonomyOverrideId.ToString()) : "") + (this.TaxonomySelectId > 0 ? ("&SelTaxonomyId=" + this.TaxonomySelectId.ToString()) : "") + "&back_file=" + back_file + "&back_action=" + back_action + "&back_folder_id=" + back_folder_id + "&back_id=" + back_id + "&back_form_id=" + back_form_id + "&control=" + controlName + "&buttonid=" + buttonId.Value + "&back_LangType=" + back_LangType + back_callerpage + back_origurl); if (Request.QueryString["pullapproval"] != null) { FormAction += (string)("&pullapproval=" + Request.QueryString["pullapproval"]); } PostBackPage.Text = "<script>document.forms[0].action = \"" + FormAction + "\";"; if (Utilities.IsAssetType(lContentType)) { PostBackPage.Text += "document.forms[0].enctype = \"multipart/form-data\";"; } PostBackPage.Text += "</script>"; LoadingImg.Text = m_refMsg.GetMessage("one moment msg"); content_title.Value = Server.HtmlDecode(m_strContentTitle); if (content_title.Attributes["class"] == null) { content_title.Attributes.Add("class", ""); } if (lContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) { content_title.Attributes["class"] = "masterlayout"; if (!(m_strType == "update")) { content_title.Disabled = true; } phAlias.Visible = false; EditAliasHtml.Visible = false; } else { content_title.Attributes.Remove("class"); } if (EnableMultilingual == 1) { lblLangName.Text = "[" + language_data.Name + "]"; } StringBuilder sbFolderBreadcrumb = new StringBuilder(); string strDisabled = ""; if (!(m_strType == "update")) { QLink_Search.Text = "<td nowrap=\"nowrap\" class=\"checkboxIsSearchable\" >"; QLink_Search.Text += "<input type=\"hidden\" name=\"AddQlink\" value=\"AddQlink\">"; if (Request.Cookies[DMSCookieName] != null && Request.Cookies[DMSCookieName].Value == "2010") { if (folder_data.IscontentSearchable) QLink_Search.Text += "<input type=\"hidden\" name=\"IsSearchable\" value=\"IsSearchable\">"; } else { if (security_data.IsAdmin) { if (folder_data.IscontentSearchable) QLink_Search.Text += "<input type=\"checkbox\" name=\"IsSearchable\" " + strDisabled + " checked value=\"IsSearchable\" >" + m_refMsg.GetMessage("lbl content searchable"); //m_refMsg.GetMessage("Content Searchable") else QLink_Search.Text += "<input type=\"checkbox\" name=\"IsSearchable\" " + strDisabled + " >" + m_refMsg.GetMessage("lbl content searchable"); //m_refMsg.GetMessage("Content Searchable") } else { //Need to inherit from parent. if (folder_data.IscontentSearchable) QLink_Search.Text += "<input type=\"hidden\" name=\"IsSearchable\" value=\"IsSearchable\">"; } } QLink_Search.Text += "</td>"; } else { TR_Properties.Visible = false; TR_Properties.Height = new Unit(0); } if (QLink_Search.Text != "") { QLink_Search.Text = "<table><tr>" + QLink_Search.Text + "</tr></table>"; } content_id.Value = Convert.ToString(m_refContentId); eType.Value = m_strType; mycollection.Value = strMyCollection; addto.Value = strAddToCollectionType; content_folder.Value = Convert.ToString(m_intContentFolder); content_language.Value = Convert.ToString(intContentLanguage); maxcontentsize.Value = iMaxContLength.ToString(); if (bVer4Editor) { Ver4Editor.Value = "true"; } else { Ver4Editor.Value = "false"; } createtask.Value = Request.QueryString["dontcreatetask"]; EnumeratedHiddenFields.Text = HideVariables(); eWebEditProJS.Text = EditProJS(); if (m_intContentType == 2) { divContentText.Text = m_refMsg.GetMessage("form text"); divSummaryText.Text = m_refMsg.GetMessage("postback text"); } else { divContentText.Text = m_refMsg.GetMessage("content text"); divSummaryText.Text = m_refMsg.GetMessage("Summary text"); } phMetadata.Visible = true; if (this.Request.QueryString["type"] == "update") { aliasContentType = this.content_edit_data.ContType.ToString(); } if ((m_urlAliasSettings.IsManualAliasEnabled || m_urlAliasSettings.IsAutoAliasEnabled) && m_refContApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias) && Request.QueryString["type"] != "multiple,add" && lContentSubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //And Not (m_bIsBlog) { if ((content_edit_data != null) && (content_edit_data.AssetData != null) && Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_edit_data.AssetData.FileExtension))) { phAlias.Visible = false; EditAliasHtml.Visible = false; } else { phAlias.Visible = true; EditAliasHtml.Visible = true; } } EditContentHtmlScripts(); EditSummaryHtmlScripts(); EditMetadataHtmlScripts(); EditAliasHtmlScripts(); EditScheduleHtmlScripts(); EditCommentHtmlScripts(); EditSubscriptionHtmlScripts(); EditSelectedTemplate(); EditTaxonomyScript(); if (eWebEditProPromptOnUnload == 1) { jsActionOnUnload.Text = "eWebEditPro.actionOnUnload = EWEP_ONUNLOAD_PROMPT;"; } if (Convert.ToString(m_intContentFolder) != "") { defaultFolderId.Text = m_intContentFolder.ToString(); } else { defaultFolderId.Text = "0"; } //Summary_Meta_win if (!String.IsNullOrEmpty(Request.QueryString["summary"])) { Summary_Meta_Win.Text = "<script language=\"JavaScript1.2\">"; Summary_Meta_Win.Text += "PopUpWindow(\'editsummaryarea.aspx?id=" + m_intItemId + "&LangType=" + m_intContentLanguage + "&editor=true\',\'Summary\',790,580,1,1);"; Summary_Meta_Win.Text += "</script>"; } if (!String.IsNullOrEmpty(Request.QueryString["meta"])) { Summary_Meta_Win.Text += "<script language=\"JavaScript1.2\">"; if (MetaDataNumber > 0) { Summary_Meta_Win.Text += "PopUpWindow(\'editmeta_dataarea.aspx?id=" + m_intItemId + "&LangType=" + m_intContentLanguage + "&editor=true\',\'Metadata\',790,580,1,1);"; } else { Summary_Meta_Win.Text += "alert(\'No metadata defined\'); "; } Summary_Meta_Win.Text += "</script>"; } //TAXONOMY DATA if (IsAdmin || m_refContApi.EkUserRef.IsARoleMember(Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.TaxonomyAdministrator), CurrentUserID, false)) { TaxonomyRoleExists = true; } TaxonomyBaseData[] taxonomy_cat_arr = null; if (m_strType != "add" && m_strType != "multiple" && (!(m_strType.IndexOf("add", System.StringComparison.InvariantCultureIgnoreCase) > 0 || m_strType.IndexOf("multiple", System.StringComparison.InvariantCultureIgnoreCase) > 0)) || (m_strType == "add" && m_refContentId > 0)) { int tmpLang = 1033; int originalLangID = 1033; if (m_strType == "add" && m_refContentId > 0) //New Language { if (!(Request.QueryString["con_lang_id"] == null) && Request.QueryString["con_lang_id"] != "") { originalLangID = Convert.ToInt32(Request.QueryString["con_lang_id"]); } tmpLang = m_refContent.RequestInformation.ContentLanguage; //Backup the current langID m_refContent.RequestInformation.ContentLanguage = originalLangID; taxonomy_cat_arr = m_refContent.ReadAllAssignedCategory(m_refContentId); m_refContent.RequestInformation.ContentLanguage = tmpLang; } else { taxonomy_cat_arr = m_refContent.ReadAllAssignedCategory(m_intItemId); } if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0) { foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr) { if (taxonomy_cat.LanguageId == 0 || taxonomy_cat.LanguageId == m_refContent.RequestInformation.ContentLanguage) { if (taxonomyselectedtree.Value == "") { taxonomyselectedtree.Value = Convert.ToString(taxonomy_cat.Id); } else { taxonomyselectedtree.Value = taxonomyselectedtree.Value + "," + Convert.ToString(taxonomy_cat.Id); } } } } TaxonomyTreeIdList = (string)taxonomyselectedtree.Value; if (TaxonomyTreeIdList.Trim().Length > 0) { if (m_strType == "add" && m_refContentId > 0) //New Language { m_refContent.RequestInformation.ContentLanguage = originalLangID; //Backup the current LangID TaxonomyTreeParentIdList = m_refContent.ReadDisableNodeList(m_refContentId); m_refContent.RequestInformation.ContentLanguage = tmpLang; } else { TaxonomyTreeParentIdList = m_refContent.ReadDisableNodeList(m_intItemId); } } } else { if (TaxonomySelectId > 0) { taxonomyselectedtree.Value = TaxonomySelectId.ToString(); TaxonomyTreeIdList = (string)taxonomyselectedtree.Value; taxonomy_cat_arr = m_refContent.GetTaxonomyRecursiveToParent(TaxonomySelectId, m_refContent.RequestInformation.ContentLanguage, 0); if ((taxonomy_cat_arr != null) && taxonomy_cat_arr.Length > 0) { foreach (TaxonomyBaseData taxonomy_cat in taxonomy_cat_arr) { if (TaxonomyTreeParentIdList == "") { TaxonomyTreeParentIdList = Convert.ToString(taxonomy_cat.Id); } else { TaxonomyTreeParentIdList = TaxonomyTreeParentIdList + "," + Convert.ToString(taxonomy_cat.Id); } } } } } TaxonomyRequest taxonomy_request = new TaxonomyRequest(); TaxonomyBaseData[] taxonomy_data_arr = null; Utilities.SetLanguage(m_refContApi); taxonomy_request.TaxonomyId = m_intContentFolder; taxonomy_request.TaxonomyLanguage = m_refContApi.ContentLanguage; taxonomy_data_arr = m_refContent.GetAllFolderTaxonomy(m_intContentFolder); bool HideCategoryTab = false; if (Request.QueryString["HideCategoryTab"] != null) { HideCategoryTab = Convert.ToBoolean(Request.QueryString["HideCategoryTab"]); } if (HideCategoryTab || (taxonomy_data_arr == null || taxonomy_data_arr.Length == 0) && (TaxonomyOverrideId == 0)) { if (!HideCategoryTab && folder_data != null && folder_data.FolderType == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.FolderType.Blog) && TaxonomySelectId > 0 && m_intTaxFolderId == folder_data.Id && TaxonomyTreeIdList.Trim().Length > 0) { m_intTaxFolderId = 0; } else { phTaxonomy.Visible = false; EditTaxonomyHtml.Visible = false; DisplayTab = false; taxonomyselectedtree.Value = taxonomy_cat_arr != null && taxonomy_cat_arr.Length > 0 && (taxonomy_cat_arr[0].LanguageId == 0 | taxonomy_cat_arr[0].LanguageId == m_refContent.RequestInformation.ContentLanguage) ? taxonomyselectedtree.Value : ""; } } //CALL THE TOOLBAR if (folder_data == null) { LoadToolBar(""); } else { LoadToolBar(folder_data.Name); } if (lContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent) { WebEventCont.Text = "true"; phContent.Visible = false; phEditContent.Visible = false; } //-------------------DisplayTabs Based on selected options from Folder properties---------------------------------- if (((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) == (int)EkEnumeration.FolderTabDisplaySettings.AllTabs) && folder_data.DisplaySettings != 0) { if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Summary) == (int)EkEnumeration.FolderTabDisplaySettings.Summary) { phEditSummary.Visible = true; } else { if (Request.QueryString["form_type"] == null && Request.QueryString["back_form_id"] == null && Request.QueryString["form_id"] == null && m_bIsBlog != true) { phEditSummary.Visible = false; phSummary.Visible = false; } } if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.MetaData) == (int)EkEnumeration.FolderTabDisplaySettings.MetaData) {if(phMetadata.Visible) phMetadata.Visible = true; } else { if (!metadataRequired) phMetadata.Visible = false; } if ((m_urlAliasSettings.IsManualAliasEnabled || m_urlAliasSettings.IsAutoAliasEnabled) && m_refContApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias) && Request.QueryString["type"] != "multiple,add" && lContentSubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //And Not (m_bIsBlog) { if (!((content_edit_data != null) && (content_edit_data.AssetData != null) && Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_edit_data.AssetData.FileExtension)))) { if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Aliasing) == (int)EkEnumeration.FolderTabDisplaySettings.Aliasing) { phAlias.Visible = true; } else { if (!folder_data.AliasRequired) phAlias.Visible = false; } } } if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Schedule) == (int)EkEnumeration.FolderTabDisplaySettings.Schedule) { PhSchedule.Visible = true; } else { PhSchedule.Visible = false; } if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Comment) == (int)EkEnumeration.FolderTabDisplaySettings.Comment) { PhComment.Visible = true; } else { PhComment.Visible = false; } if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Templates) == (int)EkEnumeration.FolderTabDisplaySettings.Templates) { phTemplates.Visible = true; } else { phTemplates.Visible = false; } if ((folder_data.DisplaySettings & (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy) == (int)EkEnumeration.FolderTabDisplaySettings.Taxonomy) { if(phTaxonomy.Visible) phTaxonomy.Visible = true; } else { if (!folder_data.IsCategoryRequired) phTaxonomy.Visible = false; } } //-------------------DisplayTabs Based on selected options from Folder properties End------------------------------ } catch (Exception ex) { throw (new Exception(ex.Message)); } }