protected void Page_Load(object sender, System.EventArgs e) { //30257- This document should never be cached. When content status changes //the page is refreshed to show change in status. This change does //not appear when page is cached. Response.Cache.SetCacheability(HttpCacheability.NoCache); long contentid = 0; //long folderid = 0; int ContentLanguage = -1; CommonApi AppUI = new CommonApi(); Ektron.Cms.ContentAPI content_api = new Ektron.Cms.ContentAPI(); if (! (Request.QueryString["id"] == null)) { contentid = Convert.ToInt64(Request.QueryString["id"]); if ((!(Request.QueryString["LangType"] == null)) && (int.TryParse(Request.QueryString["LangType"], out ContentLanguage)) && (ContentLanguage > 0)) { if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { ContentLanguage = AppUI.DefaultContentLanguage; } AppUI.ContentLanguage = ContentLanguage; content_api.ContentLanguage = ContentLanguage; } else { ContentLanguage = AppUI.DefaultContentLanguage; } content_edit_data = content_api.GetContentForEditing(contentid); if (! (Request.QueryString["executeActiveX"] == null) && Request.QueryString["executeActiveX"] == "true" ) { string strfilename; AssetManagement.AssetManagementService assetmanagementService = new AssetManagement.AssetManagementService(); Ektron.ASM.AssetConfig.AssetData assetData = assetmanagementService.GetAssetData(content_edit_data.AssetData.Id); strfilename = (string) (GetFolderPath(content_edit_data.FolderId) + assetData.Handle); string sJS = ""; if (Page.Request.UserAgent.ToLower().Contains("firefox")) { sJS = "editDocumentWithProgIDNoUI('" + getFilePath(content_edit_data.FolderId) + assetData.Handle + "', '', 'SharePoint.OpenDocuments', '0', '" + getSiteAddress() + "', '0');"; string backURL = content_api.AppPath + Page.Request.QueryString["back_callerpage"] + "?" + Page.Request.QueryString["back_origurl"]; sJS += "window.location.href='" + this.Request.UrlReferrer + "'"; }else { sJS = "editInMSOffice(\'" + strfilename + "\');"; } Page.ClientScript.RegisterStartupScript(typeof(Page), "ShowInOffice", sJS.ToString(), true); } } }
public string getchildfolders(long folderid) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); Ektron.Cms.ContentAPI capi = new Ektron.Cms.ContentAPI(); Ektron.Cms.FolderData[] folders = capi.GetChildFolders(folderid, true, Ektron.Cms.Common.EkEnumeration.FolderOrderBy.Name); Ektron.Cms.PageBuilder.WireframeModel wfm = new WireframeModel(); if (folders != null && folders.Length > 0) { foreach (FolderData folder in folders) { Ektron.Cms.PageBuilder.WireframeData[] wireframes = wfm.FindByFolderID(folder.Id); sb.Append("<li class=\""); if (folder.HasChildren) sb.Append("ui-finder-folder"); if (wireframes.Length > 0) sb.Append(" hasWireframe"); sb.Append("\"><a href=\""); sb.Append(capi.AppPath + "/PageBuilder/Wizards/folderbrowser/folderbrowserCB.ashx?folderid="); sb.Append(folder.Id); sb.Append("\">"); sb.Append(folder.Name); sb.Append("</a></li>"); } } return sb.ToString(); }
protected void Page_Load(object sender, System.EventArgs e) { Page.Response.ContentType = "text/xml"; Page.Response.Clear(); Page.Response.BufferOutput = true; string text = ""; int pageNumber = 1; int totalPages = 0; int MaxResults = 0; int iLoop = 1; string strID = ""; StringBuilder strFields = new StringBuilder(); string strOnclick = ""; long contentId = 0; long selectedId = -1; int languageID = m_commonApi.RequestInformationRef.ContentLanguage; m_refMsg = m_commonApi.EkMsgRef; Ektron.Cms.ContentAPI content_api = null; content_api = new Ektron.Cms.ContentAPI(); if (content_api.GetCookieValue("LastValidLanguageID") != "" && Convert.ToInt32(content_api.GetCookieValue("LastValidLanguageID")) != -1) { languageID = Convert.ToInt32(content_api.GetCookieValue("LastValidLanguageID")); } text = Request.QueryString["text"]; if (!string.IsNullOrEmpty(Request.QueryString["pnum"]) && Convert.ToInt32(Request.QueryString["pnum"]) > 0) { pageNumber = Convert.ToInt32(Request.QueryString["pnum"]); } if (!string.IsNullOrEmpty(Request.QueryString["cid"])) { contentId = Convert.ToInt64(Request.QueryString["cid"]); } if (!string.IsNullOrEmpty(Request.QueryString["selectedid"])) { selectedId = Convert.ToInt64(Request.QueryString["selectedid"]); } Ektron.Cms.API.Search.SearchManager search = new Ektron.Cms.API.Search.SearchManager(); SearchRequestData requestData = new SearchRequestData(); requestData.SearchFor = Ektron.Cms.WebSearch.SearchDocumentType.all; requestData.SearchText = text; requestData.PageSize = 10; requestData.LanguageID = languageID; requestData.CurrentPage = pageNumber; int resultCount = 0; SearchResponseData[] result = search.Search(requestData, HttpContext.Current, ref resultCount); StringBuilder str = new StringBuilder(); StringBuilder strRet = new StringBuilder(); int tmpCount = 0; string strLink = ""; string[] arLink = null; MaxResults = requestData.PageSize; if (resultCount != 0) { str.Append("<table width=\"100%\" class=\"ektronGrid\">"); foreach (SearchResponseData data in result) { strLink = ""; strID = (string)("ek_sel_cont" + iLoop); if (data.QuickLink.IndexOf("http://") > -1) { strLink = (string)(data.QuickLink); strLink = strLink.Substring(7); strLink = "http://" + strLink.Replace("\'", "\\\'").Replace("//", "/"); } if (strLink.ToLower().IndexOf("window.open") < 0) { arLink = strLink.Split("?".ToCharArray()); if (arLink.Length > 1) { strLink = arLink[0]; arLink = arLink[1].Split("&".ToCharArray()); foreach (string val in arLink) { if (val.IndexOf("terms=") == -1) { if (strLink == "") { strLink = val; } else { if (strLink.IndexOf("?") < 0) { strLink = strLink + "?" + val; } else { strLink = strLink + "&" + val; } } } } } } strOnclick = "SelectContent(\'" + strID + "\',\'" + strLink + "\')"; str.Append("<tr><td valign=\"top\" style=\"width:1%;\" valign=\"top\">"); str.Append("<input type=\"radio\" "); if (selectedId != -1 && selectedId == data.ContentID) { str.Append(" checked=\"true\" "); } if (data.ContentID == contentId) { str.Append(" disabled "); } str.Append("onclick=\"" + strOnclick + "\" id=\""); str.Append(strID); str.Append("\" name=\"ek_sel_cont\"/></td><td valign=\"top\">"); str.Append("<span onclick=\"" + strOnclick + "\" class=\"title\">"); str.Append(data.Title).Append("</span><br/>"); str.Append("<span onclick=\"SelectContent(\'" + strID + "\',\'" + strLink + "\')\" class=\"summary\">"); if (data.ContentType != 2 && data.ContentType != 4) { str.Append(data.Summary.Replace("<p> </p>", "").Replace("<p> </p>", "").Replace("<p> </p>", "")); } str.Append("</span></td></tr>"); strFields.Append(",").Append(strID); iLoop++; } } if (resultCount > 0 && MaxResults > 0) { if (resultCount % MaxResults == 0) { totalPages = resultCount / MaxResults; } else { tmpCount = System.Convert.ToInt32(resultCount / MaxResults); if (tmpCount * MaxResults < resultCount) { totalPages = tmpCount + 1; } else { totalPages = tmpCount; } } } str.Append("</table>"); if (totalPages == 0) { strRet = new StringBuilder(); strRet.Append("<content>"); strRet.Append("<table style=\"width:100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"); strRet.Append("<tr><td>" + m_refMsg.GetMessage("alt no related content") + "</td></tr>"); strRet.Append("</table>"); strRet.Append("</content>"); strRet.Append("<totalPages>").Append(totalPages).Append("</totalPages>"); } else { strRet.Append("<content>"); strRet.Append("<div class=\"header\">" + m_refMsg.GetMessage("lbl total") + ": ").Append(resultCount).Append("<br/>"); strRet.Append("" + m_refMsg.GetMessage("page lbl") + ": ").Append(pageNumber).Append(" " + m_refMsg.GetMessage("lbl of") + " ").Append(totalPages).Append("</div>"); strRet.Append(str.ToString()); strRet.Append("</content>"); strRet.Append("<totalPages>").Append(totalPages).Append("</totalPages>"); } Response.Write(strRet.ToString()); }
private void CheckForMasterLayout(long FolderID) { Ektron.Cms.ContentAPI contentApi = new Ektron.Cms.ContentAPI(); Ektron.Cms.Content.EkContent m_refContent; Ektron.Cms.Common.EkContentCol ekContentColl; m_refContent = m_refContentApi.EkContentRef; Collection coll = new Collection(); coll.Add(FolderID, "FolderID", null, null); coll.Add("-1", "ContentLanguage", null, null); coll.Add(Ektron.Cms.Common.EkEnumeration.ContentOrderBy.Id, "OrderBy", null, null); coll.Add(Ektron.Cms.Common.EkEnumeration.CMSContentType.Content, "ContentType", null, null); coll.Add(Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData, "ContentSubType", null, null); ekContentColl = null; int totalpages = 1; ekContentColl = m_refContent.GetAllViewableChildContentInfoV5_0(coll, 1, 10000, ref totalpages); if ((ekContentColl != null) && ekContentColl.Count > 0) { int j = 0; Ektron.Cms.FolderData masterLayoutFolder = m_refContent.GetFolderById(FolderID); for (j = 0; j <= ekContentColl.Count - 1; j++) { if (MasterLayouts == string.Empty) { MasterLayouts = "Template Name: " + masterLayoutFolder.NameWithPath + ekContentColl.get_Item(j).Title; } else { MasterLayouts += ", Template Name: " + masterLayoutFolder.NameWithPath + ekContentColl.get_Item(j).Title; } } } }
private void CheckFolders(long FolderID) { Ektron.Cms.ContentAPI contentApi = new Ektron.Cms.ContentAPI(); CheckForMasterLayout(FolderID); Ektron.Cms.FolderData[] folderData = contentApi.GetChildFolders(FolderID, true, Ektron.Cms.Common.EkEnumeration.FolderOrderBy.Id); if ((folderData != null) && folderData.Length > 0) { int i = 0; for (i = 0; i <= folderData.Length - 1; i++) { CheckFolders(folderData[i].Id); } } }
private void ProcessMenuRequest() { Ektron.Cms.ContentAPI myContent = new Ektron.Cms.ContentAPI(); Ektron.Cms.CommonApi AppUI = new Ektron.Cms.CommonApi(); Ektron.Cms.API.User.User myUser = new Ektron.Cms.API.User.User(); long contentId = Convert.ToInt64(Request.QueryString["contentId"]); int languageId = -1; long taxonomyOverrideId = 0; if (Request.QueryString["dmsLanguageId"] != null) { if (Request.QueryString["dmsLanguageId"] != String.Empty) { languageId = Convert.ToInt32(Request.QueryString["dmsLanguageId"]); if (languageId == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || languageId == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { languageId = AppUI.DefaultContentLanguage; } AppUI.ContentLanguage = languageId; myContent.ContentLanguage = languageId; } } //createIeSpecificMenu is an argument passed to the constructor of the DMSMenuContentAPI class //This arg tells DMSMenuContentAPI whether or not to include the IE specific functionality //namely, this funcitonality is the office-specific stuff (Edit In Microsoft Office, View in Microsoft Office). Boolean createIeSpecificMenu = false; if (Request.QueryString["createIeSpecificMenu"] != String.Empty) { createIeSpecificMenu = Convert.ToBoolean(Request.QueryString["createIeSpecificMenu"]); } string dmsMenuType = String.Empty; string dmsMenuSubtype = String.Empty; long communityGroupID = 0; if (!String.IsNullOrEmpty(Request.QueryString["communityDocuments"])) { // Dms community menus may carry additional data (i.e. group id). string[] splitDmsMenuTypeInfo = Request.QueryString["communityDocuments"].Split( new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); dmsMenuType = splitDmsMenuTypeInfo[0]; if (splitDmsMenuTypeInfo.Length == 2) { long.TryParse(splitDmsMenuTypeInfo[1], out communityGroupID); } } Ektron.Cms.ContentData myContentData = new Ektron.Cms.ContentData(); Ektron.Cms.API.Content.Content apiCont = new Ektron.Cms.API.Content.Content(); Ektron.Cms.ContentStateData stateData = apiCont.GetContentState(contentId); if (stateData.Status == "A") myContentData = apiCont.GetContent(contentId, Ektron.Cms.ContentAPI.ContentResultType.Published); else myContentData = apiCont.GetContent(contentId, Ektron.Cms.ContentAPI.ContentResultType.Staged); string dmsMenuGuid; XsltArgumentList myDMSMenuArguments = new XsltArgumentList(); Ektron.Cms.Workarea.Dms.DmsMenu myDMSMenu; if (dmsMenuType != "") { bool queryDynamicContentBox = false; string controlID = String.Empty; if (Request.QueryString["dynamicContentBox"] != null) { queryDynamicContentBox = Convert.ToBoolean(Request.QueryString["DynamicContentBox"]); if (dmsMenuType.ToLower() == "communityuser" || dmsMenuType.ToLower() == "communitygroup" && EkConstants.IsAssetContentType(myContentData.ContType, true) && myContentData.ContType !=(int) EkEnumeration.CMSContentType.Multimedia) { if (myContentData.AssetData != null && !EkFunctions.IsImage("." + myContentData.AssetData.FileExtension) && myContentData.Type !=(int) EkEnumeration.CMSContentType.Multimedia) { queryDynamicContentBox = false; } } myDMSMenuArguments.AddParam("dynamicContentBox", String.Empty, queryDynamicContentBox); } if (Request.QueryString["dmsEktControlID"] != null) { controlID = Request.QueryString["dmsEktControlID"].ToString(); myDMSMenuArguments.AddParam("dmsEktControlID", String.Empty, controlID); } if (Request.QueryString["taxonomyOverrideId"] != null) { taxonomyOverrideId = Convert.ToInt64(Request.QueryString["taxonomyOverrideId"]); } } if (Request.QueryString["dmsMenuGuid"] != null) { dmsMenuGuid = Request.QueryString["dmsMenuGuid"].ToString(); myDMSMenuArguments.AddParam("dmsMenuGuid", String.Empty, dmsMenuGuid); } Boolean IsPhotoGallery = true; if (Request.QueryString["dmsMenuSubtype"] != null) { dmsMenuSubtype = Request.QueryString["dmsMenuSubtype"].ToString(); myDMSMenuArguments.AddParam("dmsMenuSubtype", String.Empty, dmsMenuSubtype); IsPhotoGallery = (dmsMenuSubtype == "photo"); } string fromPage = String.Empty; if (Request.QueryString["fromPage"] != null) { fromPage = Request.QueryString["fromPage"].ToString(); myDMSMenuArguments.AddParam("fromPage", String.Empty, fromPage); } switch (dmsMenuType.ToLower()) { case "taxonomy": //Taxonomy Implementation //Use Taxnonomy constructor overload //public DmsMenu(ektronDmsMenuMenuType menuType, int contentId, int userId, int contentLanguage, int folderId, int contentType, Boolean createIESpecificMenu, int taxonomyOverrideId) if (Request.QueryString["communityGroupid"] != null) { long.TryParse(Request.QueryString["communityGroupid"].ToString(), out communityGroupID); } myDMSMenu = new Ektron.Cms.Workarea.Dms.DmsMenu(ektronDmsMenuMenuType.Taxonomy, contentId, myUser.UserId, languageId, myContentData.FolderId, myContentData.Type, createIeSpecificMenu, taxonomyOverrideId, communityGroupID); break; case "communityuser": //Community User Implementation //Use Community User constructor overload //public DmsMenu(ektronDmsMenuMenuType menuType, int contentId, int userId, int contentLanguage, int folderId, int contentType, Boolean createIESpecificMenu, Boolean isPhotoGallery) myDMSMenu = new Ektron.Cms.Workarea.Dms.DmsMenu(ektronDmsMenuMenuType.CommunityUser, contentId, myUser.UserId, languageId, myContentData.FolderId, myContentData.Type, createIeSpecificMenu, IsPhotoGallery); break; case "communitygroup": //Community Group Implementation //Use Community Group constructor overload //public DmsMenu(ektronDmsMenuMenuType menuType, int contentId, int userId, int contentLanguage, int folderId, int contentType, Boolean createIESpecificMenu, int taxonomyOverrideId, int communityGroupId, Boolean isPhotoGallery) myDMSMenu = new Ektron.Cms.Workarea.Dms.DmsMenu(ektronDmsMenuMenuType.CommunityGroup, contentId, myUser.UserId, languageId, myContentData.FolderId, myContentData.Type, createIeSpecificMenu, taxonomyOverrideId, communityGroupID, IsPhotoGallery, fromPage); break; case "favorites": //Favorites Menu Implementation //Use Favorites constructor overload //public DmsMenu(ektronDmsMenuMenuType menuType, int contentId, int userId, int contentLanguage, int folderId, int contentType, Boolean createIESpecificMenu, int taxonomyOverrideId, int communityGroupId, Boolean isPhotoGallery) myDMSMenu = new Ektron.Cms.Workarea.Dms.DmsMenu(ektronDmsMenuMenuType.Favorites, contentId, myUser.UserId, languageId, myContentData.FolderId, myContentData.Type, createIeSpecificMenu, taxonomyOverrideId, communityGroupID, IsPhotoGallery, fromPage); break; case "workarea": default: //Workarea Implementation //Use Workarea constructor overload //public DmsMenu(ektronDmsMenuMenuType menuType, int contentId, int userId, int contentLanguage, int folderId, int contentType, Boolean createIESpecificMenu) myDMSMenu = new Ektron.Cms.Workarea.Dms.DmsMenu(ektronDmsMenuMenuType.Workarea, contentId, myUser.UserId, languageId, myContentData.FolderId, myContentData.Type, createIeSpecificMenu, fromPage); break; } DMSMenu.Text = myDMSMenu.GetDmsMenu(myDMSMenuArguments); }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { Session["EkDavSessionVal"] = null; } m_refMsg = m_refContApi.EkMsgRef; Utilities.ValidateUserLogin(); RegisterResources(); aHelp.HRef = "#Help"; aHelp.Attributes.Add("onclick", "window.open('" + m_refContApi.fetchhelpLink("add_assets") + "', '', 'width=800,height=500,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no');return false;"); setLocalizedStrings(); if (Request.QueryString["folderiD"] != null) { _folderID = Convert.ToInt64(Request.QueryString["folderID"]); jsFolderID.Text = _folderID.ToString(); } if (Request.QueryString["TaxonomyId"] != null) { _taxonomyID = Convert.ToInt64(Request.QueryString["TaxonomyId"]); jsTaxonomyId.Text = _taxonomyID.ToString(); jsTaxonomyIdReloadFrame.Text = _taxonomyID.ToString(); jsTaxID.Text = _taxonomyID.ToString(); isMetadataOrTaxonomyRequired = true; } if (Request.QueryString["LangType"] != null) { _contentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); jsLanguageID.Text = _contentLanguage.ToString(); } if (m_refContApi.EkContentRef.DoesFolderRequireMetadataOrTaxonomy(_folderID, _contentLanguage)) { isMetadataOrTaxonomyRequired = true; } ExplorerDragDrop dragDrop = new ExplorerDragDrop(); bool _useSSL = Ektron.Cms.Common.EkFunctions.GetConfigBoolean("ek_UseOffloadingSSL", false); string _scheme = string.Empty; if (_useSSL) { _scheme = "https"; } else { _scheme = Page.Request.Url.Scheme; } destination.Value = Convert.ToString(_scheme + Uri.SchemeDelimiter + this.Page.Request.Url.Authority + m_refContApi.ApplicationPath) + "processMultiupload.aspx?close=true"; PostURL.Value = Convert.ToString(_scheme + Uri.SchemeDelimiter + this.Page.Request.Url.Authority + m_refContApi.ApplicationPath) + "processMultiupload.aspx?close=true"; NextUsing.Value = Convert.ToString(_scheme + Uri.SchemeDelimiter + Page.Request.Url.Authority + m_refContApi.ApplicationPath + "content.aspx"); content_id.Value = "-1"; content_folder.Value = _folderID.ToString(); content_language.Value = _contentLanguage.ToString(); requireMetaTaxonomy.Value = isMetadataOrTaxonomyRequired.ToString(); taxonomyselectedtree.Value = _taxonomyID.ToString(); content_teaser.Value = ""; HtmlGenericControl linebreak = new HtmlGenericControl("div"); linebreak.InnerHtml += "<div id=\'divFileTypes\' style=\'display:none;float:left;\'> " + m_refMsg.GetMessage("lbl valid file types") + "<p class=\'dmsSupportedFileTypes\' style=\'font-size:11px;\'>" + DocumentManagerData.Instance.FileTypes + "</p></div>"; linebreak.InnerHtml += "<br />"; linebreak.InnerHtml += "<div id=idMultipleView style=\'display:inline\'>"; linebreak.InnerHtml += (string) ("<script type=\"text/javascript\">" + Environment.NewLine); linebreak.InnerHtml += (string) (" AC_AX_RunContent(\'id\',\'idUploadCtl\',\'name\',\'idUploadCtl\',\'classid\',\'CLSID:07B06095-5687-4d13-9E32-12B4259C9813\',\'width\',\'100%\',\'height\',\'350px\');" + Environment.NewLine); linebreak.InnerHtml += Environment.NewLine + " </script> </div> " + Environment.NewLine; linebreak.InnerHtml += "<br /><br />"; //tabMultipleDMS.Controls.Add(linebreak); if (Request.Cookies[DMSCookieName] != null && !string.IsNullOrEmpty(Request.Cookies[DMSCookieName].Value)) { pnl_versionToggle.Visible = pnl_DMSMultiUpload.Visible = true; pnl_OfficeVerSelector.Visible = false; if (Request.Cookies[DMSCookieName].Value == "2010") { ExplorerDragDrop edd = new ExplorerDragDrop(); string ekdavurl=edd.GetFolderPath(_folderID).Replace(Page.Request.Url.GetLeftPart(UriPartial.Authority), ""); try { string[] urlparts = ekdavurl.Split('_'); urlparts[4] = _taxonomyID.ToString(); ekdavurl = string.Join("_", urlparts); } catch { } destination.Value = ekdavurl;//edd.GetFolderPath(_folderID).Replace(Page.Request.Url.GetLeftPart(UriPartial.Authority), ""); putopts.Value = "false"; Upload.OnClientClick = "return MultipleDocumentUpload(0);"; lbtn_toggleVersion.Attributes.Add("onclick", string.Format(m_refMsg.GetMessage("js office version toggle confirm format"), m_refMsg.GetMessage("li text office 2010 name"))); lbtn_toggleVersion.Text = m_refMsg.GetMessage("lbtn dms switch office version") + "(Office 2010 selected)"; } else { destination.Value = _scheme + Uri.SchemeDelimiter + this.Page.Request.Url.Authority + m_refContApi.ApplicationPath + "processMultiupload.aspx?close=true"; PostURL.Value = _scheme + Uri.SchemeDelimiter + this.Page.Request.Url.Authority + m_refContApi.ApplicationPath + "processMultiupload.aspx?close=true"; putopts.Value = "true"; Upload.OnClientClick = "MultipleDocumentUpload(1);"; lbtn_toggleVersion.Attributes.Add("onclick", string.Format(m_refMsg.GetMessage("js office version toggle confirm format"), m_refMsg.GetMessage("li text other office ver name"))); lbtn_toggleVersion.Text = m_refMsg.GetMessage("lbtn dms switch office version") + "(Office 2003/2007 selected)"; } tabMultipleDMS.Controls.Add(linebreak); } else { pnl_versionToggle.Visible = pnl_DMSMultiUpload.Visible = false; pnl_OfficeVerSelector.Visible = true; } if (Request.QueryString["showtab"] != null && Request.QueryString["showtab"] == "multiple") { ltrNoUpload.Text = m_refMsg.GetMessage("lbl upload file"); ClientScript.RegisterStartupScript(this.GetType(), "selectTab", "var ddTabs = $ektron('#DMStabs').tabs({select: function(event, ui){ResizeDocumentContainer(ui);}}); ddTabs.tabs('select', 1);", true); } if (! Page.IsPostBack) { dragDrop.FolderID = _folderID; dragDrop.TaxonomyId = _taxonomyID; if (_contentLanguage != -1) { dragDrop.ContentLanguage = _contentLanguage; } HelpMessage.Text = "Fill out the description and then click next to upload image(s)."; //m_refMsg.GetMessage("lbl fill out the description and then click next to drag and drop image(s)") btnNext.Text = m_refMsg.GetMessage("next") + ">>"; ImagegalleryTitleLbl = m_refMsg.GetMessage("generic title label"); ImagegalleryImageWidthLbl = m_refMsg.GetMessage("lbl maximum width"); ImagegalleryAddressLbl = m_refMsg.GetMessage("lbl image mapaddress"); ImagegalleryDescriptionLbl = m_refMsg.GetMessage("description label"); HeaderLabel.Text = m_refMsg.GetMessage("lbl photo data"); btnNext.Attributes.Add("onclick", "ResizeContainer();"); if ((Request.QueryString["prop"] != null)&& Request.QueryString["prop"] != "" && (Request.QueryString["type"] == "update") || (Request.QueryString["prop"] == "image")) { // Content Designer ctlEditor.FolderId = _folderID; ctlEditor.AllowFonts = true; if (Request.QueryString["prop"] == "image") { dragDrop.IsImage = 1; } this.panelImageProperties.Visible = true; this.panelDragDrop.Visible = false; if ((Request.QueryString["type"] != null)&& Request.QueryString["type"] == "update") { HelpMessage.Text = m_refMsg.GetMessage("lbl fill out the description and then click save"); btnNext.Attributes.Add("onclick", "return HideContainer(this);"); long id = 0; if (Request.QueryString["id"] != null) { id = Convert.ToInt64(Request.QueryString["id"]); } ekImagegalleryImageWidthLbl.Visible = false; ekImagegalleryImageWidth.Visible = false; if (id > 0) { Ektron.Cms.ContentData data; Ektron.Cms.ContentAPI api = new Ektron.Cms.ContentAPI(); data = api.GetContentById(id, 0); this.ekImagegalleryTitle.Value = Server.HtmlDecode(data.Title); ctlEditor.Content = data.Teaser; if (Request.QueryString["prop"] == "image") { this.HeaderLabel.Text = "Image Properties"; foreach (Ektron.Cms.ContentMetaData item in data.MetaData) { if (item.TypeName.ToLower() == "mapaddress") { this.ekImagegalleryAddress.Value = item.Text; break; } } } else { this.HeaderLabel.Text = "Document Properties"; this.ekImagegalleryAddress.Visible = false; this.ekImagegalleryAddressLbl.Visible = false; } btnNext.Text = "Save"; } } else { ekImagegalleryTitleLbl.Visible = false; ekImagegalleryTitle.Visible = false; } } else { this.panelImageProperties.Visible = false; this.panelDragDrop.Visible = true; } } else { Ektron.Cms.CommonApi api = new Ektron.Cms.CommonApi(); string desc = ""; int width = 800; string address = ""; desc = (string) ctlEditor.Content; if (Request.Form["ekImagegalleryImageWidth"] != null) { width = System.Convert.ToInt32(Request.Form["ekImagegalleryImageWidth"].ToString()); } if (Request.Form["ekImagegalleryAddress"] != null) { address = (string) (Request.Form["ekImagegalleryAddress"].ToString()); } string[] imageProp = new string[4]; imageProp[0] = width.ToString(); //width imageProp[1] = "-1"; //height imageProp[2] = address; //mapaddress imageProp[3] = desc; //Descriptions if (Request.QueryString["type"] != "update") { Ektron.ASM.EkDavProtocol.Constants.GetCustomCacheManger().Remove(api.UserId.ToString() + "_" + api.UniqueId.ToString() + "_MapMeta"); Ektron.ASM.EkDavProtocol.Constants.GetCustomCacheManger().Add(api.UserId.ToString() + "_" + api.UniqueId.ToString() + "_MapMeta", imageProp); } } if (Request.Browser.Type.IndexOf("Firefox") != -1) { liDragDrop.Visible = true; tabDragDrop.Visible = true; tabDragDrop.Controls.Add(dragDrop); } literal_wait.Text = m_refMsg.GetMessage("one moment msg"); }
public static string GetAssetDownloadLink(long content_id) { Ektron.Cms.ContentAPI content_api = null; ContentData content_data = null; try { content_api = new Ektron.Cms.ContentAPI(); content_data = content_api.GetContentById(content_id, 0); if (content_data.AssetData == null || content_data.AssetData.Id.Trim().Length == 0) { return string.Empty; } return content_api.RequestInformationRef.ApplicationPath + "/DownloadAsset.aspx?id=" + content_id; } catch (Exception) { return string.Empty; } }
/// <summary> /// Configurate the Asset file by its content id to find out if the image needed to /// be created before calling the Response object, bypassing IIS /// </summary> /// <param name="contentId">content id associated to the asset</param> /// <param name="context">current HttpContext object</param> private void WriteAssetToResponse(long contentId, HttpContext context) { string assetPath = string.Empty; Ektron.Cms.ContentAPI capi = new Ektron.Cms.ContentAPI(); int lang = capi.RequestInformationRef.ContentLanguage; int langBak = lang; if (context.Request.QueryString["langType"] != null) { Int32.TryParse(context.Request.QueryString["langType"], out lang); } bool createImg = false; int size = 0; int width = 0; int height = 0; bool libraryThumbnail = false; string sz = context.Request.QueryString["sz"]; if (sz != null) { if (true == Int32.TryParse(sz, out size)) { createImg = true; } else { libraryThumbnail = ("thumb" == sz.ToLower()); size = 120; // default library thumbnail size } } string wd = context.Request.QueryString["wd"]; if (wd != null) { Int32.TryParse(wd, out width); } string ht = context.Request.QueryString["ht"]; if (ht != null) { Int32.TryParse(ht, out height); } if (width > 0 || height > 0) { createImg = true; } try { // GetLibraryItemByContentID() figures out their fallback language in the database L10n_GetContentLanguage capi.RequestInformationRef.ContentLanguage = lang; Ektron.Cms.LibraryData data = capi.GetLibraryItemByContentID(contentId); if (data != null) { string assetFileName = data.FileName; string assetFilePath = context.Server.MapPath(assetFileName); // This is too expensive to get the friendly name with the following method. It will be updated when new // API is availabe to get asset id, asset GUID name and asset handle with other library properties. Currently, // the GUID name is in used as the display name when user right-clicks on image and select "save image as". //string assetId = System.IO.Path.GetFileNameWithoutExtension(assetFileName); //AssetManagement.AssetManagementService assetmanagementService = new AssetManagement.AssetManagementService(); //Ektron.ASM.AssetConfig.AssetData assetDetails = assetmanagementService.GetAssetData(assetId); //string displayFileName = assetDetails.Handle; string displayFileName = System.IO.Path.GetFileName(assetFileName); Ektron.Cms.API.ImageHelper g = new Ektron.Cms.API.ImageHelper(assetFileName); if ("images" == data.Type && (true == createImg || true == libraryThumbnail)) { string imageFileName = EkFunctions.GetThumbnailForContent(assetFileName); imageFileName = System.IO.Path.ChangeExtension(imageFileName, "png"); assetFilePath = context.Server.MapPath(imageFileName); if (true == libraryThumbnail) { try { // serve the previously created thumbnail image g.WriteExistingFileToResponse(assetFilePath, displayFileName, data.DateCreated, context.Response); } catch (FileNotFoundException) { // create the thumbnail for its first time this.CreateImage(g, imageFileName, size, width, height, true); g.WriteNewFileToResponse(displayFileName, context.Response, this.cacheDays); } } else { // create the customized image this.CreateImage(g, imageFileName, size, width, height, false); g.WriteNewFileToResponse(displayFileName, context.Response, this.cacheDays); } } else { // serve the original asset g.WriteExistingFileToResponse(assetFilePath, displayFileName, data.DateCreated, context.Response); } g = null; } } finally { capi.RequestInformationRef.ContentLanguage = langBak; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // register JS/CSS files ICmsContextService cmsContextService = ServiceFactory.CreateCmsContextService(); Package resources = new Package() { Components = new List<Component>() { Packages.EktronCoreJS, Packages.jQuery.jQueryUI.Tabs, Packages.jQuery.Plugins.Cookie, JavaScript.Create(cmsContextService.WorkareaPath + "/java/plugins/modal/ektron.modal.js"), Ektron.Cms.Framework.UI.Css.Create(cmsContextService.WorkareaPath + "/java/plugins/modal/ektron.modal.css") } }; resources.Register(this); if (!Page.IsCallback && Request.QueryString["tab"] != null && Request.QueryString["tab"].ToString() == "traffic") { ltrShowTrafficTab.Visible = true; } _contentAPI = new Ektron.Cms.ContentAPI(); _quotesMissingMessage = GetMessage("lbl quotes are missing"); DateRangePicker1.BadStartDateFormatMessage = GetMessage("msg bad start date format"); DateRangePicker1.BadEndDateFormatMessage = GetMessage("msg bad end date format"); DateRangePicker1.BadStartDateFormatErrorHandler += BadDateFormatErrorHandler; DateRangePicker1.BadEndDateFormatErrorHandler += BadDateFormatErrorHandler; DateRangePicker1.BadDateRange += BadDateRangeErrorHandler; DateRangePicker1.MaximumDate = DateTime.Today; DateRangePicker1.DefaultEndDate = DateTime.Today.AddDays(-1); // today is a partial day DateRangePicker1.DefaultStartDate = DateRangePicker1.DefaultEndDate.AddDays(-30); ProviderSelect.OnProviderChanged += ProviderChangedHandler; if (!string.IsNullOrEmpty(ProviderSelect.ProviderName)) { SegmentPersistenceId = _dataManager.GetSegmentFilterCookieName(ProviderSelect.ProviderName); } AnalyticsReport.ProviderSegments = this.CookieSegments; //page lblClose.InnerText = GetMessage("close title"); lblSEO.InnerText = GetMessage("generic seo"); lblGoogle.InnerText = GetMessage("generic google"); lblW3c.InnerText = GetMessage("generic w3c"); lblAlexa.InnerText = GetMessage("generic alexa"); lblImages.InnerText = GetMessage("generic images"); lblText.InnerText = GetMessage("text"); lblMeta.InnerText = GetMessage("generic meta"); ChangeURLButton.Text = GetMessage("btn change"); ChangeURLButton.ToolTip = ChangeURLButton.Text; lblTraffic.InnerText = GetMessage("generic traffic"); if(AnalyticsSecurity.Enabled(_contentAPI.RequestInformationRef) == false) { liTrafficTab.Visible = false; tabTraffic.Visible = false; tabSEO.Visible = true; } else { liTrafficTab.Visible = true; tabTraffic.Visible = true; } string sDescription = GetMessage("generic description"); string sPageLooksOnMobile = GetMessage("lbl what page looks like in mobile device"); //tabSEO lblUrl.Text = GetMessage("lbl url"); lblUrl.ToolTip = lblUrl.Text; lblDescSEO.InnerText = GetMessage("lbl seo seo tab desc"); lblTitle.Text = GetMessage("generic title"); lblDesc.Text = sDescription; lblKeywords.Text = GetMessage("sam keywords"); LblLang.Text = GetMessage("generic language"); lblCharSet.Text = GetMessage("lbl character set"); lblH1Tag.Text = GetMessage("lbl first h1 tag"); //tabGoogle lblDescGoogle.InnerText = GetMessage("lbl seo google tab desc"); lblLinkThisPage.Text = GetMessage("lbl pages that links to this page"); lblIndexedPages.Text = GetMessage("lbl indexed pages in your site"); lblCachedVersion.Text = GetMessage("lbl current cached version of this page"); lblAboutThisPage.Text = GetMessage("lbl information google has about this page"); lblSimilarToPage.Text = GetMessage("lbl pages that are similar to this page"); lblMobileImgLooks.Text = sPageLooksOnMobile; lblMobileNoImgLooks.Text = sPageLooksOnMobile; //tabW3C lblDescW3c.InnerText = GetMessage("lbl seo w3c tab desc"); lblCheckMarkup.Text = GetMessage("lbl check markup"); lblCheckLinks.Text = GetMessage("lbl checks broken links"); lblCheckCss.Text = GetMessage("lbl checks cascading style sheets"); lblCheckMobilePhones.Text = GetMessage("lbl checks mobile phones"); //tabAlexa lblDescAlexa.InnerText = GetMessage("lbl seo alexa tab desc"); lblOverviewAlexa.Text = GetMessage("lbl overview from alexa"); lblTrafficDetails.Text = GetMessage("lbl traffic details"); lblRelatedSites.Text = GetMessage("lbl related sites"); lblAlexaKeywords.Text = GetMessage("lbl alexa search terms"); lblAlexaClickstream.Text = GetMessage("lbl alexa upstream"); lblLinkToSites.Text = GetMessage("lbl link to sites"); //tabImages lblDescImg.InnerText = GetMessage("lbl seo img tab desc"); lblStatus.Text = GetMessage("generic status"); lblAltTag.Text = GetMessage("generic alt tag"); lblImg.Text = GetMessage("generic image"); //tabText lblDescText.InnerText = GetMessage("lbl seo text tab desc"); //tabMeta lblDescMeta.InnerText = GetMessage("lbl seo meta tab desc"); //tabTraffic if (!IsPostBack) { litLoadingMessage.Text = GetMessage("generic loading"); // TODO should be label w/o viewstate } }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); Utilities.ValidateUserLogin(); m_SelectedEditControl = Utilities.GetEditorPreference(Request); objCookieObject = Ektron.Cms.CommonApi.GetEcmCookie(); if (objCookieObject != null && !(objCookieObject.Values["editoroptions"] == null)) { m_SelectedEditControl = objCookieObject.Values["editoroptions"].ToLower(); } if (m_SelectedEditControl.ToLower() == "jseditor") { cdContent_teaser.Visible = false; } bool bPermissions = true; m_refContentApi = new Ektron.Cms.ContentAPI(); iNewLang = m_refContentApi.ContentLanguage; if (!String.IsNullOrEmpty(Request.QueryString["dynamicbox"])) { bDynamicBox = Convert.ToBoolean(Request.QueryString["dynamicbox"]); } if (!String.IsNullOrEmpty(Request.QueryString["forum"])) { try { IsForum = Convert.ToBoolean(Convert.ToInt32(Request.QueryString["forum"])); } catch (Exception) { IsForum = false; } } setlabels(); if (!IsForum && m_SelectedEditControl.ToLower() == "jseditor") { AddEkDoPostBack(); } this.dialog_publish.Attributes.Add("onclick", "return publish_handler();"); this.dialog_publish_top.Attributes.Add("onclick", "return publish_handler();"); this.dialog_publish_asset.Attributes.Add("onclick", "return publish_handler();"); if (!String.IsNullOrEmpty(Request.QueryString["mode"])) { if (Request.QueryString["mode"].Trim().ToLower() == "edit") { Mode = CurrentMode.Edit; } else if (Request.QueryString["mode"].Trim().ToLower() == "addlang") { Mode = CurrentMode.Edit; bWithLang = true; if (!String.IsNullOrEmpty(Request.QueryString["Lang"])) iOrigLang = Convert.ToInt32(Request.QueryString["Lang"]); } else { Mode = CurrentMode.Add; } } SetCSS(); if (!String.IsNullOrEmpty(Request.QueryString["mode_id"])) { try { ModeID = Convert.ToInt64(Request.QueryString["mode_id"]); } catch (Exception) { ModeID = 0; } } if (!String.IsNullOrEmpty(Request.QueryString["lang_id"])) { try { LangID = Convert.ToInt32(Request.QueryString["lang_id"]); } catch (Exception) { LangID = m_refContentApi.RequestInformationRef.DefaultContentLanguage; } } if (!String.IsNullOrEmpty(Request.QueryString["langtype"])) { try { LangID = Convert.ToInt32(Request.QueryString["langtype"]); } catch (Exception) { LangID = m_refContentApi.RequestInformationRef.DefaultContentLanguage; } } if (LangID == -1 || LangID == 0) { LangID = m_refContentApi.RequestInformationRef.DefaultContentLanguage; } m_refContentApi.RequestInformationRef.ContentLanguage = LangID; m_refContentApi.ContentLanguage = LangID; if (!Page.IsPostBack) { if (m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.TaxonomyAdministrator, m_refContentApi.RequestInformationRef.UserId, false)) { TaxonomyRoleExists = true; } switch (Mode) { case CurrentMode.Add: auto_generate_summary.Visible = false; content_id.Value = "0"; security_data = m_refContentApi.LoadPermissions(ModeID, "folder", 0); if (!security_data.CanAdd) { title_label.Text = "You do not have rights to add content in FolderID=" + ModeID; bPermissions = false; } else { Ektron.Cms.API.Folder folderApi = new Ektron.Cms.API.Folder(); folder_data = folderApi.GetFolder(ModeID); if (folder_data != null) { if (cssFilesPath == "") //apply stylesheet from folderdata { cssFilesPath = this.m_refContentApi.RequestInformationRef.SitePath + folder_data.StyleSheet; } if (cssFilesPath.Length > 0) { cdContent_teaser.Stylesheet = cssFilesPath; } } cdContent_teaser.FolderId = ModeID; if (!IsForum && m_SelectedEditControl.ToLower() == "jseditor") { InnerEditor.ToolbarLayout = SetToolbar(); ftb_control.Text = InnerEditor.ToString(); ftb_control.Visible = true; cdContent_teaser.Visible = false; } else if (!IsForum) { ftb_control.Visible = false; cdContent_teaser.Visible = true; } SetTaxonomy(0, ModeID); } break; case CurrentMode.Edit: auto_generate_summary.Visible = true; content_id.Value = ModeID.ToString(); if (!String.IsNullOrEmpty(Request.QueryString["mode"]) && Request.QueryString["mode"].Trim().ToLower() == "addlang") { long folderid = 0; if (!String.IsNullOrEmpty(Request.QueryString["folder"])) { long.TryParse(Request.QueryString["folder"], out folderid); } security_data = m_refContentApi.LoadPermissions(folderid, "folder", 0); if (!security_data.CanAdd) { title_label.Text = "You do not have rights to add language content block ID=" + ModeID; bPermissions = false; } } else { security_data = m_refContentApi.LoadPermissions(ModeID, "content", 0); if (!security_data.CanEdit && !IsForum) { title_label.Text = "You do not have rights to edit content block ID=" + ModeID; bPermissions = false; } else { Ektron.Cms.API.Folder folderApi = new Ektron.Cms.API.Folder(); folder_data = folderApi.GetFolder(ModeID); if (folder_data != null) { if (cssFilesPath == "") //apply stylesheet from folderdata { cssFilesPath = this.m_refContentApi.RequestInformationRef.SitePath + folder_data.StyleSheet; } if (cssFilesPath.Length > 0) { cdContent_teaser.Stylesheet = cssFilesPath; } } } } if (bPermissions) { if (Request.QueryString["ctlupdateid"] != "") { commparams = (string)("&ctlupdateid=" + Request.QueryString["ctlupdateid"] + "&ctlmarkup=" + Request.QueryString["ctlmarkup"] + "&cltid=" + Request.QueryString["cltid"] + "&ctltype=" + Request.QueryString["ctltype"]); updateFieldId = Request.QueryString["ctlupdateid"]; Page.ClientScript.RegisterHiddenField("ctlupdateid", updateFieldId); } if (Request.QueryString["ctlmarkup"] != "") { Page.ClientScript.RegisterHiddenField("ctlmarkup", Request.QueryString["ctlmarkup"]); } if (Request.QueryString["ctltype"] != "") { Page.ClientScript.RegisterHiddenField("ctltype", Request.QueryString["ctltype"]); } if (Request.QueryString["cltid"] != "") { Page.ClientScript.RegisterHiddenField("cltid", Request.QueryString["cltid"]); } SetContentBlock(); } break; } if (!bPermissions) { ftb_control.Visible = false; title_value.Visible = false; dialog_publish.Visible = false; dialog_publish_top.Visible = false; dialog_publish_asset.Visible = false; cdContent_teaser.Visible = false; return; } ltr_js.Text = this.EditorJS(); if (m_SelectedEditControl.ToLower() != "jseditor") { ftb_control.Visible = false; //set the equavalent SetToolbar() to contentdesigner if (cdContent_teaser != null) { string ToolsOption = ""; if (security_data.CanAdd) { ToolsOption = "Wiki=1"; } bool bLibraryAllowed = false; if (security_data.IsReadOnlyLib) { bLibraryAllowed = true; } ToolsOption = ToolsOption + ("&LibraryAllowed=" + bLibraryAllowed.ToString()); bool bCanModifyImg = false; if (security_data.CanAddToImageLib) { bCanModifyImg = true; } ToolsOption = ToolsOption + ("&CanModifyImg=" + bCanModifyImg.ToString()); if (ToolsOption.Length > 0) { ToolsOption = (string)("?" + ToolsOption); } cdContent_teaser.SetPermissions(security_data); cdContent_teaser.ToolsFile = this.m_refContentApi.RequestInformationRef.ApplicationPath + "ContentDesigner/configurations/InterfaceBlog.aspx" + ToolsOption; if (!(Request.QueryString["editorVisible"] == null)) { //To avoid the editor's onbeforeunload checks being called cdContent_teaser.Visible = System.Convert.ToBoolean(Request.QueryString["editorVisible"]); } } } } if (dialog_publish.Visible == true) { tr_pub.Visible = true; tr_asset.Visible = false; } else { tr_pub.Visible = false; tr_asset.Visible = true; } string _helpUrl = string.Empty; if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ek_helpDomainPrefix"])) { string helpDomain = ConfigurationManager.AppSettings["ek_helpDomainPrefix"]; Uri _uri = new Uri(helpDomain); if (_uri != null && !_uri.IsFile) { if ((helpDomain.IndexOf("[ek_cmsversion]") > 1)) { //defect # 64951 - This help file (It had been its own help project in previous releases as well). _helpUrl = " http://documentation.ektron.com/current/memberhelp/wwhelp/wwhimpl/js/html/wwhelp.htm"; } } else { _helpUrl = this.m_refContentApi.RequestInformationRef.ApplicationPath + "/helpmessage.aspx?error=isfile"; } } else { _helpUrl = this.m_refContentApi.RequestInformationRef.ApplicationPath + "/help/memberhelp/index.html"; } help_button.Text = "<a href=\"#\"><img id=\"DeskTopHelp\" title=\"" + this.m_refMsg.GetMessage("alt help button text") + "\" border=\"0\" src=\"" + this.m_refContentApi.RequestInformationRef.ApplicationPath + "/images/application/menu/help.gif\" onclick=\"javascript:PopUpWindow(\'" + _helpUrl + "\', \'SitePreview\', 600, 500, 1, 1);return false;\"></a>"; if (IsForum) { SetForumMode(); } }
private void Page_Load(System.Object sender, System.EventArgs e) { RegisterResources(); //StyleSheetJS.Text = (new StyleHelper()()).GetClientScript; StyleHelper sh = new StyleHelper(); StyleSheetJS.Text = sh.GetClientScript(); m_refMsg = (new CommonApi()).EkMsgRef; if (!(Request.QueryString["action"] == null)) { if (Request.QueryString["action"] != "") { m_strPageAction = Request.QueryString["action"].ToLower(); } } 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")); } } try { Ektron.Cms.ContentAPI m_refContentApi = new Ektron.Cms.ContentAPI(); if (! Utilities.ValidateUserLogin()) { return; } if (! m_refContentApi.IsAdmin()) { Response.Redirect((string) ("reterror.aspx?info=" + m_refContentApi.EkMsgRef.GetMessage("msg login cms administrator")), false); return; } switch (m_strPageAction) { case "managecustompermissions": m_customroles = (customroles) (LoadControl("controls/roles/customroles.ascx")); DataHolder.Controls.Add(m_customroles); break; default: m_rolemembermgr = (rolemembermgr) (LoadControl("controls/roles/rolemembermgr.ascx")); m_rolemembermgr.ID = "role"; DataHolder.Controls.Add(m_rolemembermgr); break; } } catch (Exception ex) { Utilities.ShowError(ex.Message); } }
protected void Page_Load(object sender, System.EventArgs e) { try { Ektron.Cms.ContentAPI content_api = new Ektron.Cms.ContentAPI(); Ektron.Cms.Content.EkContent m_refContent = content_api.EkContentRef; Ektron.Cms.ContentData content_data = null; long content_id = 0; bool valid_attempt = false; int ContentLanguage; CommonApi AppUI = new CommonApi(); if (! (Request.QueryString["id"] == null)) { content_id = Convert.ToInt64(Request.QueryString["id"]); if ((!(Request.QueryString["content_language"] == null)) && (int.TryParse(Request.QueryString["content_language"], out ContentLanguage)) && (ContentLanguage > 0)) { if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED || ContentLanguage == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES) { ContentLanguage = AppUI.DefaultContentLanguage; } AppUI.ContentLanguage = ContentLanguage; content_api.ContentLanguage = ContentLanguage; } else { ContentLanguage = AppUI.DefaultContentLanguage; } //if checkout was clicked bool checkOutAsset; if ((! (Request.QueryString["checkout"] == null)) && (bool.TryParse(Request.QueryString["checkout"], out checkOutAsset)) && (checkOutAsset)) { ContentData contData = content_api.GetContentById(content_id, ContentAPI.ContentResultType.Staged); //If checkout and save was clicked on a content in the "S" state, checkout will throw an exception //Take ownership of content before checkout if ((contData != null) && (contData.UserId != content_api.RequestInformationRef.UserId) && (contData.Status == "S")) { content_api.EkContentRef.TakeOwnership(content_id); } content_api.EkContentRef.CheckContentOutv2_0(content_id); } // if (content_id > 0) { content_data = content_api.GetContentById(content_id, 0); } if ((content_data != null) && (content_data.AssetData != null) && (content_data.AssetData.Version.Length > 0)) { //GetContentById returns content in default language if no content exists for ContentLanguage if (content_data.LanguageId == ContentLanguage) { AssetManagement.AssetManagementService objAssetMgtService; objAssetMgtService = new AssetManagement.AssetManagementService(); string filepath = objAssetMgtService.GetViewUI(content_data.AssetData.Id, Ektron.ASM.AssetConfig.InstanceType.current, content_data.AssetData.Version,Ektron.ASM.AssetConfig.UIType.url); if ((Request.QueryString["originalimage"] != null)&& Request.QueryString["originalimage"] == "true") { string _path = (string) (content_api.EkContentRef.GetViewUrl(Convert.ToInt32(content_data.Type), content_data.AssetData.Id).Replace(Page.Request.Url.Scheme + "://" + Page.Request.Url.Host, "")); if (_path.StartsWith(":")) //If https the assetmanagementservice tends to send the port number too { _path = _path.Substring(_path.IndexOf("/")); } filepath = Page.Server.MapPath(_path); //filepath = filepath.Replace(content_data.AssetData.Id, (string) ("orig_" + content_data.AssetData.Id)); if (filepath != null) { if (File.Exists(filepath)) { valid_attempt = true; AssetManagement.AssetManagementService assetmanagementService = new AssetManagement.AssetManagementService(); Ektron.ASM.AssetConfig.AssetData assetData = assetmanagementService.GetAssetData(content_data.AssetData.Id); Response.Clear(); //Response.ContentType = "application/octet-stream" Response.ContentType = content_data.AssetData.MimeType; Response.AddHeader("Content-Disposition", "attachment; filename=\"" + HttpUtility.UrlPathEncode(assetData.Handle) + "\""); Response.WriteFile(filepath); Response.Flush(); try { Response.End(); } catch { } return; } } } if (filepath.IndexOf("?") >= 0) { filepath = filepath + "&mimeType=octet"; } else { filepath = filepath + "?mimeType=octet"; } Response.Redirect(filepath); } } if (! valid_attempt) { notification_message.Text = "File does not exist or you do not have permission to view this file"; } } } catch (System.Threading.ThreadAbortException) { notification_message.Text = ""; } catch (Exception) { notification_message.Text = "File does not exist or you do not have permission to view this file"; } }
private void Populate_ViewTopicRepliesGrid(EkTasks replydata) { System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); string strTag; string strtag1; int nReplyCount; strTag = "<a href=\"content.aspx?LangType=" + _ContentApi.ContentLanguage + "&action=" + _PageAction + "&orderby="; strtag1 = "&id=" + _Id + (_ContentTypeQuerystringParam != "" ? "&" + _ContentTypeUrlParam + "=" + _ContentTypeQuerystringParam : "") + "\" title=\"" + _MessageHelper.GetMessage("click to sort msg") + "\">"; FolderDataGrid.ShowHeader = false; colBound.DataField = "PREVIEW"; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(145); FolderDataGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "TITLEDESCRIPTION"; //colBound.ItemStyle.Wrap = False colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left; FolderDataGrid.Columns.Add(colBound); FolderDataGrid.BorderColor = System.Drawing.Color.White; FolderDataGrid.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0); FolderDataGrid.CellPadding = 6; FolderDataGrid.CellSpacing = 2; DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("PREVIEW", typeof(string))); dt.Columns.Add(new DataColumn("TITLEDESCRIPTION", typeof(string))); string ApproveURL = ""; string ViewUrl = ""; string EditUrl = ""; string DeleteUrl = ""; string ReplyURL = ""; string sAppend = ""; int i; nReplyCount = replydata.Count; Ektron.Cms.ContentAPI contapi = new Ektron.Cms.ContentAPI(); dr = dt.NewRow(); for (i = 1; i <= replydata.Count; i++) { if (replydata.get_Item(i) != null) { if (int.Parse(replydata.get_Item(i).State) == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.BlogCommentState.Completed) || (int.Parse(replydata.get_Item(i).State) == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.BlogCommentState.Pending) && ((!(_PermissionData == null) && (_PermissionData.IsAdmin || _PermissionData.CanAddToImageLib)) || this._ContentApi.RequestInformationRef.CallerId == replydata.get_Item(i).CreatedByUserID))) { dr = dt.NewRow(); if (!string.IsNullOrEmpty(Request.QueryString["contentid"])) { sAppend = (string)("&forumid=" + _Id.ToString() + "&contentid=" + Request.QueryString["contentid"]); } else { sAppend = (string)("&forumid=" + _Id.ToString()); } ViewUrl = (string)("tasks.aspx?action=ViewTask&tid=" + replydata.get_Item(i).TaskID.ToString() + "&fromViewContent=1&ty=both&LangType=" + _ContentApi.ContentLanguage); EditUrl = (string)("threadeddisc/addeditreply.aspx?action=Edit&topicid=" + _ContentId.ToString() + "&forumid=" + this._Id.ToString() + "&id=" + replydata.get_Item(i).TaskID.ToString() + "&boardid=" + _BoardID.ToString()); if (i == 1) { EditUrl += "&type=topic"; } ReplyURL = (string)("threadeddisc/addeditreply.aspx?action=Add&topicid=" + _ContentId.ToString() + "&forumid=" + this._Id.ToString() + "&id=" + replydata.get_Item(i).TaskID.ToString() + "&boardid=" + _BoardID.ToString()); if (int.Parse(replydata.get_Item(i).State) == Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.BlogCommentState.Pending)) { ApproveURL = (string)("tasks.aspx?action=ApproveTask&tid=" + replydata.get_Item(i).TaskID.ToString() + "&ty=both" + sAppend); dr[0] = "<a name=\"reply" + replydata.get_Item(i).TaskID.ToString() + "\"></a><table border=\"0\" cellspacing=\"6\" width=\"125\"><tr><td colspan=\"2\" align=\"center\">"; dr[0] += "<br/><img border=\"4\" style=\"border-width: 5px; border-color: gold\" src=\"" + _ContentApi.AppImgPath + "thumb_forumpost.gif\" width=\"53\" height=\"55\"/><br/>"; dr[0] += "</td></tr>"; dr[0] += "<tr><td width=\"50%\">"; if (_PermissionData.IsReadOnlyLib == true) { dr[0] += "<a href=\"" + ReplyURL + "\">" + _MessageHelper.GetMessage("lbl reply") + "</a>"; } else { dr[0] += _MessageHelper.GetMessage("lbl reply"); } dr[0] += "</td><td width=\"50%\">"; if (_PermissionData.CanAddToImageLib == true) { dr[0] += "<a href=\"" + EditUrl + "\">" + _MessageHelper.GetMessage("generic edit title") + "</a>"; } else { dr[0] += _MessageHelper.GetMessage("generic edit title"); } dr[0] += "</td></tr>"; if (i > 1) { dr[0] += "<tr><td width=\"50%\">"; if (!(_PermissionData == null) && (_PermissionData.IsAdmin || _PermissionData.CanAddToImageLib)) { dr[0] += "<a href=\"" + ApproveURL + "\">approve</a>"; } else { dr[0] += "approve"; } } } else { ApproveURL = ""; dr[0] = "<a name=\"reply" + replydata.get_Item(i).TaskID.ToString() + "\"><table border=\"0\" cellspacing=\"6\" width=\"125\"><tr><td colspan=\"2\" align=\"center\">"; dr[0] += "<br/><img src=\"" + _ContentApi.AppImgPath + "thumb_forumpost.gif\" width=\"53\" height=\"55\"/><br/>"; dr[0] += "</td></tr>"; dr[0] += "<tr><td width=\"50%\">"; if (_PermissionData.IsReadOnlyLib == true) { dr[0] += "<a href=\"" + ReplyURL + "\">" + _MessageHelper.GetMessage("lbl reply") + "</a>"; } else { dr[0] += _MessageHelper.GetMessage("lbl reply"); } dr[0] += "</td><td width=\"50%\">"; if ((i == 1 && _PermissionData.CanEdit) || contapi.UserId == replydata.get_Item(i).CreatedByUserID) { dr[0] += "<a href=\"" + EditUrl + "\">" + _MessageHelper.GetMessage("generic edit title") + "</a>"; } else { dr[0] += _MessageHelper.GetMessage("generic edit title"); } dr[0] += "</td></tr>"; //We do not need approve button when there's no approval for that post reply //If i > 1 Then // dr(0) &= "<tr><td width=""50%"">" // dr(0) &= _MessageHelper.GetMessage("btn approve") //End If } if (i > 2) { DeleteUrl = (string)("tasks.aspx?action=DeleteTask&tid=" + replydata.get_Item(i).TaskID.ToString() + "&ty=both" + sAppend); dr[0] += "</td><td width=\"50%\">"; if (_PermissionData.IsAdmin || _PermissionData.CanAddToImageLib == true || contapi.UserId == replydata.get_Item(i).CreatedByUserID) { dr[0] += "<a href=\"" + DeleteUrl + "\" onclick=\"return confirm(\'" + _MessageHelper.GetMessage("msg del comment") + "\');\">" + _MessageHelper.GetMessage("generic delete title") + "</a>"; } else { dr[0] += _MessageHelper.GetMessage("generic delete title"); } dr[0] += "</td></tr>"; } dr[0] += "</table>"; if (replydata.get_Item(i).CreatedByUserID == -1) { dr[1] += "<span id=\"ReplyDesc\" class=\"ReplyDesc\" style=\"color:gray;display:block;\">" + (replydata.get_Item(i).Description) + "</span><span style=\"color:green;display:block;\">" + _MessageHelper.GetMessage("lbl posted by") + " " + _MessageHelper.GetMessage("lbl anon") + " " + _MessageHelper.GetMessage("res_isrch_on") + " " + replydata.get_Item(i).DateCreated.ToString() + "</span>"; } else { dr[1] += "<span id=\"ReplyDesc\" class=\"ReplyDesc\" style=\"color:gray;display:block;\">" + (replydata.get_Item(i).Description) + "</span><span style=\"color:green;display:block;\">" + _MessageHelper.GetMessage("lbl posted by") + " " + replydata.get_Item(i).CommentDisplayName + " " + _MessageHelper.GetMessage("res_isrch_on") + " " + replydata.get_Item(i).DateCreated.ToString() + "</span>"; } if (!(replydata.get_Item(i).FileAttachments == null) && replydata.get_Item(i).FileAttachments.Length > 0) { dr[1] += "<br/>"; dr[1] += "<br/>"; string filetmp = ""; for (int k = 0; k <= (replydata.get_Item(i).FileAttachments.Length - 1); k++) { if (replydata.get_Item(i).FileAttachments[k].DoesExist == true) { filetmp += (string)(" <img src=\'" + this._ContentApi.AppPath + "images/ui/icons/filetypes/file.png\' /> <a href=\"" + replydata.get_Item(i).FileAttachments[k].Filepath + "\" target=\"_blank\" class=\"ekattachment\">" + replydata.get_Item(i).FileAttachments[k].Filename + "</a> <span class=\'attachinfo\'>(" + replydata.get_Item(i).FileAttachments[k].FileSize.ToString() + " bytes)</span><br/>" + Environment.NewLine); } } if (filetmp.Length > 0) // if we have at least one attachment { filetmp = (string)((" <span class=\"ekattachments\">File Attachment(s):</span><br/>" + Environment.NewLine) + filetmp + (" <br/>" + Environment.NewLine)); dr[1] += filetmp; } } dt.Rows.Add(dr); } } } DataView dv = new DataView(dt); FolderDataGrid.DataSource = dv; FolderDataGrid.DataBind(); totalPages.Visible = false; currentPage.Visible = false; }
protected string GenerateTreeHtml(string controlId, int languageID, long taxonomyId) { string taxonomyHtml; StringBuilder sb = new StringBuilder(); ContentAPI contentAPI = new Ektron.Cms.ContentAPI(); TaxonomyRequest taxonomyRequest = new TaxonomyRequest(); taxonomyRequest.TaxonomyId = taxonomyId; taxonomyRequest.TaxonomyLanguage = languageID; Taxonomy taxonomyAPI = new Taxonomy(); TaxonomyData taxonomyData = taxonomyAPI.LoadTaxonomy(ref taxonomyRequest); if (taxonomyData.Taxonomy.Length == 0) return ""; sb.Append("<ul>"); foreach (TaxonomyData childTaxonomyData in taxonomyData.Taxonomy) { taxonomyHtml = GenerateCategoryHtml(controlId, languageID, childTaxonomyData.TaxonomyId); sb.Append(taxonomyHtml); } sb.Append("</ul>"); return sb.ToString(); }
protected void Page_Init(object sender, EventArgs e) { JS.RegisterJS(this, JS.ManagedScript.EktronJS); JS.RegisterJS(this, JS.ManagedScript.EktronModalJS); Css.RegisterCss(this, Css.ManagedStyleSheet.EktronModalCss); _host = Ektron.Cms.Widget.WidgetHost.GetHost(this); _host.Title = "Content Dashboard"; _host.Edit += new EditDelegate(EditEvent); _host.Maximize += new MaximizeDelegate(delegate() { Visible = true; }); _host.Minimize += new MinimizeDelegate(delegate() { Visible = false; }); _host.Create += new CreateDelegate(delegate() { EditEvent(""); }); PreRender += new EventHandler(delegate(object PreRenderSender, EventArgs Evt) { SetOutput(); }); _host.HelpFile = Page.ResolveClientUrl("~/WorkArea/help/personalization_new.82.1.html"); ViewSet.SetActiveView(View); Ektron.Cms.ContentAPI cApi = new Ektron.Cms.ContentAPI(); chkLocaleNotIn.Text = this.GetMessage("chk Does not include"); btnFilter.Text = this.GetMessage("lbl advanced search filter results label"); btnPrint.Text = this.GetMessage("lbl print"); btnCreate.Text = this.GetMessage("btn Create Report"); CancelButton.Text = this.GetMessage("generic cancel"); SaveButton.Text = this.GetMessage("btn save"); Utilities.ValidateUserLogin(); if (!cApi.IsAdmin() && !cApi.IsARoleMember(EkEnumeration.CmsRoleIds.AdminUsers) && !cApi.IsARoleMember(EkEnumeration.CmsRoleIds.AdminXliff) && !cApi.IsARoleMember(EkEnumeration.CmsRoleIds.AdminTranslationState)) { Response.Redirect((string)(cApi.RequestInformationRef.ApplicationPath + "reterror.aspx?info=Please login as an administrator or an Xliff Admin or a Translation state admin"), true); return; } ReportGrid1.ItemsPerPage = cApi.RequestInformationRef.PagingSize; if (!Page.IsCallback) { // Initialize the filters ddlLocale.Items.Clear(); ddlLocale.Items.Add(new ListItem("(All)", "0")); ddlLocale.Items.Add(new ListItem("(NULL)", "-1")); Dictionary<int, string> locales = ReportGrid1.GetShortLocaleList(); foreach (int id in locales.Keys) { string localecode = locales[id]; ListItem li = ddlLocale.Items.FindByText(localecode); if (li != null) // Compensate for variant-sort locale codes { li.Text = li.Text + " (" + li.Value + ")"; localecode = locales[id] + " (" + id.ToString() + ")"; } ddlLocale.Items.Add(new ListItem(localecode, id.ToString())); } ddlAuthor.Items.Clear(); ddlAuthor.Items.Add(new ListItem("(All)", "0")); Dictionary<long, string> authors = ReportGrid1.GetAuthorList(); foreach (long id in authors.Keys) ddlAuthor.Items.Add(new ListItem(authors[id], id.ToString())); Dictionary<long, string> folders = ReportGrid1.GetFolderList(0, false); bool isIE = Request.Browser.Browser.StartsWith("IE") || (!string.IsNullOrEmpty(Request.ServerVariables["User-Agent"]) && (Request.ServerVariables["User-Agent"].Contains("MSIE") || Request.ServerVariables["User-Agent"].Contains("Internet Explorer"))); foreach (long id in folders.Keys) { string foldername = folders[id]; if (isIE && foldername.Length > 32) { // Try to drop all but the last path string[] paths = foldername.Split('/'); if (paths.Length <= 3) // Only one path, so we will just shorten it foldername = foldername.Substring(0, 30) + "..."; else { // Generate some ../ instances to represent the depth int depth = paths.Length - 3; if (depth == 0) // Should never happen depth = 1; string path = paths[depth + 1]; if (path.Length > (32 - depth)) path = path.Substring(0, 30 - depth * 2) + "..."; foldername = "../../../../../../../../../../../../../../../../../../../../".Substring(0, depth * 3) + path + "/"; } } ListItem item = new ListItem(foldername, id.ToString()); ddlFolderID.Items.Add(item); if (isIE) item.Attributes.Add("title", folders[id]); } ddlStatus.Items.Clear(); ddlStatus.Items.Add(new ListItem(this.GetMessage("lbl Any"), string.Empty)); ddlStatus.Items.Add(new ListItem(this.GetMessage("lbl not ready for translation"), Ektron.Cms.Localization.LocalizationState.NotReady.ToString())); ddlStatus.Items.Add(new ListItem(this.GetMessage("lbl ready for translation"), Ektron.Cms.Localization.LocalizationState.Ready.ToString())); //ddlStatus.Items.Add(new ListItem("Needs translation", Ektron.Cms.Localization.LocalizationState.NeedsTranslation.ToString())); //ddlStatus.Items.Add(new ListItem("Out for translation", Ektron.Cms.Localization.LocalizationState.OutForTranslation.ToString())); //ddlStatus.Items.Add(new ListItem("Translated", Ektron.Cms.Localization.LocalizationState.Translated.ToString())); ddlStatus.Items.Add(new ListItem(this.GetMessage("lbl Do not translate"), Ektron.Cms.Localization.LocalizationState.DoNotTranslate.ToString())); //ddlStatus.Items.Add(new ListItem("Unknown", Ektron.Cms.Localization.LocalizationState.Undefined.ToString())); } }
public static string getQuickLink(long contentID) { var _refUrlCommonApi = new Ektron.Cms.UrlAliasing.UrlAliasCommonApi(); string quickLink = _refUrlCommonApi.GetAliasForContent(contentID); if (string.IsNullOrEmpty(quickLink)) { var m_refContentApi = new Ektron.Cms.ContentAPI(); var templateData = m_refContentApi.GetTemplatesByFolderId(m_refContentApi.GetJustFolderIdByContentId(contentID)); if (templateData.FileName.IndexOf('?') >= 0) quickLink = string.Format("{0}{1}&id={2}", m_refContentApi.SitePath, templateData.FileName, contentID); else quickLink = string.Format("{0}{1}?id={2}", m_refContentApi.SitePath, templateData.FileName, contentID); } if (string.IsNullOrEmpty(quickLink)) quickLink = string.Format("/Workarea/linkit.aspx?id={0}", contentID.ToString()); if (quickLink[0] != '/') quickLink = "/" + quickLink; return quickLink; }
private void RejectMenuRequest() { Ektron.Cms.ContentAPI myContent = new Ektron.Cms.ContentAPI(); int languageId = myContent.DefaultContentLanguage; ; string rejectionMessage = String.Empty; if (Request.QueryString["dmsLanguageId"] != null) { if (Request.QueryString["dmsLanguageId"] != String.Empty) { languageId = Convert.ToInt32(Request.QueryString["dmsLanguageId"]); } } EkMessageHelper messageHelper = myContent.EkMsgRef; DMSMenu.Text = "-1|" + messageHelper.GetMessageForLanguage("DmsMenuNotLoggedIn", languageId); }
protected void btnNext_Click(object sender, System.EventArgs e) { Ektron.Cms.CommonApi api = new Ektron.Cms.CommonApi(); string desc = ""; int width = 800; string address = ""; int isimage = 0; this.panelImageProperties.Visible = true; this.panelDragDrop.Visible = false; if (Request.QueryString["prop"] == "image") { isimage = 1; } if ((Request.QueryString["type"] != null)&& Request.QueryString["type"] == "update") { long id = 0; if (Request.QueryString["id"] != null) { id = Convert.ToInt64(Request.QueryString["id"]); Ektron.Cms.ContentEditData data; Ektron.Cms.ContentAPI apiContent = new Ektron.Cms.ContentAPI(); int metaId = 0; data = apiContent.GetContentForEditing(id); if (this.ekImagegalleryTitle.Value.IndexOf("<") != -1 || this.ekImagegalleryTitle.Value.IndexOf(">") != -1 || this.ekImagegalleryTitle.Value.IndexOf("\'") != -1 || this.ekImagegalleryTitle.Value.IndexOf("\"") != -1) { this.ekImagegalleryTitle.Value = this.ekImagegalleryTitle.Value.Replace("<", "").Replace(">", "").Replace("\'", "").Replace("\"", ""); } data.Title = (string) this.ekImagegalleryTitle.Value; data.Teaser = (string) ctlEditor.Content; content_teaser.Value = ctlEditor.Content; data.FileChanged = false; apiContent.SaveContent(data); if (Request.QueryString["prop"] == "image") { isimage = 1; foreach (Ektron.Cms.ContentMetaData item in data.MetaData) { if (item.TypeName.ToLower() == "mapaddress") { metaId = Convert.ToInt32(item.TypeId); break; } } if (metaId > 0) { apiContent.UpdateContentMetaData(data.Id, metaId, (string) this.ekImagegalleryAddress.Value); } } apiContent.PublishContentById(id, data.FolderId, data.LanguageId, "", api.UserId, ""); this.ctlEditor.Visible = false; //so that the content designer will not be initialized again. Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "close_box", "Close();", true); } } else { desc = (string) ctlEditor.Content; if (Request.Form["ekImagegalleryImageWidth"] != null) { width = System.Convert.ToInt32(Request.Form["ekImagegalleryImageWidth"].ToString()); } if (Request.Form["ekImagegalleryAddress"] != null) { address = (string) (Request.Form["ekImagegalleryAddress"].ToString()); } string[] imageProp = new string[4]; imageProp[0] = width.ToString(); //width imageProp[1] = "-1"; //height imageProp[2] = address; //mapaddress imageProp[3] = desc; //Descriptions Ektron.ASM.EkDavProtocol.Constants.GetCustomCacheManger().Remove(api.UserId.ToString() + "_" + api.UniqueId.ToString() + "_MapMeta"); Ektron.ASM.EkDavProtocol.Constants.GetCustomCacheManger().Add(api.UserId.ToString() + "_" + api.UniqueId.ToString() + "_MapMeta", imageProp); this.ctlEditor.Visible = false; //so that the content designer will not be initialized again. string _doHide = string.Empty; string _galleryString = string.Empty; if (! (Request.QueryString["hidecancel"] == null) && Request.QueryString["hidecancel"] == "true") { _doHide = "&hidecancel=true"; } if (! (Request.QueryString["isimagegallery"] == null) && Request.QueryString["isimagegallery"] == "true") { _galleryString = "&isimagegallery=true"; } Response.Redirect(m_refContApi.AppPath + "DragDropCtl.aspx?mode=0&folder_id=" + Request.QueryString["folderiD"] + "&lang_id=" + m_refContApi.ContentLanguage + "&TaxonomyId=" + Request.QueryString["TaxonomyId"] + "&isimage=" + isimage + _doHide + _galleryString); } }
protected void Page_Load(object sender, System.EventArgs e) { Ektron.Cms.ContentAPI content_api = new Ektron.Cms.ContentAPI(); try { Ektron.Cms.ContentData content_data = null; long asset_id = 0; bool valid_attempt = false; int LangbackUp = 0; if (! (Request.QueryString["id"] == null)) { asset_id = Convert.ToInt64(Request.QueryString["id"]); } LangbackUp = content_api.ContentLanguage; if (Request.QueryString["LangType"] != null && content_api.ContentLanguage == -1) { content_api.ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]); } if (content_api.ContentLanguage == -1) { content_api.ContentLanguage = int.Parse(content_api.GetCookieValue("SiteLanguage")); } long iTmpCaller = content_api.RequestInformationRef.CallerId; if (asset_id > 0) { content_api.RequestInformationRef.CallerId = Ektron.Cms.Common.EkConstants.InternalAdmin; content_api.RequestInformationRef.UserId = Ektron.Cms.Common.EkConstants.InternalAdmin; try { content_data = content_api.GetContentById(asset_id, 0); } catch { } finally { content_api.RequestInformationRef.CallerId = iTmpCaller; content_api.RequestInformationRef.UserId = iTmpCaller; } if (content_data != null) { content_api.ContentLanguage = content_data.LanguageId; content_data = null; } content_data = content_api.ShowContentById(asset_id, content_api.CmsPreview, System.Convert.ToBoolean(! content_api.CmsPreview)); content_api.ContentLanguage = LangbackUp; } if ((content_data != null) && (content_data.AssetData != null) && (content_data.AssetData.Version.Length > 0)) { string filepath = Page.Server.MapPath((string) (content_api.EkContentRef.GetViewUrl(Convert.ToInt32(content_data.Type), content_data.AssetData.Id).Replace(Page.Request.Url.Scheme + "://" + Page.Request.Url.Authority, "").Replace(":443", "").Replace(":80", ""))); if (filepath != null) { if (File.Exists(filepath)) { valid_attempt = true; string filename = Path.GetFileName(filepath); string ext = ""; ext = Path.GetExtension(filepath); AssetData _assetData = new AssetData(); _assetData.AssetDataFromAssetID(content_data.AssetData.Id); if (ext.Contains("pdf") || ext.Contains("pps")) { WebClient client = new WebClient(); byte[] Buffer = client.DownloadData(Convert.ToString(filepath)); if (Buffer.Length > 0) { valid_attempt = true; Response.Clear(); Response.ContentType = (string) ((ext.Contains("pdf")) ? "application/pdf" : "application/vnd.ms-powerpoint"); Response.AddHeader("Content-Disposition", "attachment; filename=\"" + (Request.Browser.Browser == "IE" ? (Server.UrlPathEncode(System.IO.Path.GetFileNameWithoutExtension(_assetData.Handle))) : (System.IO.Path.GetFileNameWithoutExtension(_assetData.Handle))) + ext + "\""); Response.AddHeader("Content-Length", Buffer.Length.ToString()); Response.BinaryWrite(Buffer); } } else { //if (ext.Contains("txt") || ext.Contains("nxb")) //{ // filepath = DocumentManagerData.Instance.StorageLocation + _assetData.Storage + ConfigManager.pathChar + _assetData.Name; //} Response.Clear(); Response.ContentType = content_data.AssetData.MimeType; Response.AddHeader("Content-Disposition", "attachment; filename=\"" + (Request.Browser.Browser == "IE" ? (Server.UrlPathEncode(_assetData.Handle)) : _assetData.Handle) + "\""); try { FileInfo fi = new FileInfo(filepath); Response.AddHeader("Content-Length", fi.Length.ToString()); } catch { } Response.WriteFile(filepath); } Response.Flush(); try { Response.End(); } catch { } } } } if (! valid_attempt) { notification_message.Text = "File does not exist or you do not have permission to view this file"; notification_message.ToolTip = "Error Message - " + notification_message.Text; // Register CSS Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaIeCss, Ektron.Cms.API.Css.BrowserTarget.AllIE); Login.Visible = System.Convert.ToBoolean(!content_api.IsLoggedIn); content_api.RequestInformationRef.RedirectFromLoginKeyName = Request.Url.PathAndQuery.ToString(); Login.RedirectFromLoginPage(); Login.Fill(); } } catch (Exception) { notification_message.Text = "File does not exist or you do not have permission to view this file"; // Register CSS Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaCss); Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaIeCss, Ektron.Cms.API.Css.BrowserTarget.AllIE); Login.Visible = System.Convert.ToBoolean(!content_api.IsLoggedIn); content_api.RequestInformationRef.RedirectFromLoginKeyName = Request.Url.PathAndQuery.ToString(); Login.RedirectFromLoginPage(); Login.Fill(); } }