private void PopulateContentGridData(AxMenuData menu) { if (m_strPageAction == "removeitems") { MenuItemList.Columns.Add(m_refstyle.CreateBoundField("CHECK", "<input type=\"Checkbox\" name=\"checkall\" onclick=\"checkAll(\'frm_content_ids\',false);\">", "title-header", HorizontalAlign.Center, HorizontalAlign.Center, Unit.Percentage(2), Unit.Percentage(2), false, false)); } MenuItemList.Columns.Add(m_refstyle.CreateBoundField("TITLE", m_refMsg.GetMessage("generic title"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(30), Unit.Percentage(50), false, false)); MenuItemList.Columns.Add(m_refstyle.CreateBoundField("LANGUAGE", m_refMsg.GetMessage("generic language"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); MenuItemList.Columns.Add(m_refstyle.CreateBoundField("ID", m_refMsg.GetMessage("generic id"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(5), false, false)); MenuItemList.Columns.Add(m_refstyle.CreateBoundField("URL", m_refMsg.GetMessage("generic url link"), "title-header", HorizontalAlign.Left, HorizontalAlign.NotSet, Unit.Percentage(5), Unit.Percentage(20), false, false)); DataTable dt = new DataTable(); DataRow dr; if (m_strPageAction == "removeitems") { dt.Columns.Add(new DataColumn("CHECK", typeof(string))); } dt.Columns.Add(new DataColumn("TITLE", typeof(string))); dt.Columns.Add(new DataColumn("LANGUAGE", typeof(string))); dt.Columns.Add(new DataColumn("ID", typeof(string))); dt.Columns.Add(new DataColumn("URL", typeof(string))); //If (m_strViewItem <> "folder") Then PageSettings(); //If (menu_item_data.Count > 0) Then if (menu.Item.Length > 0) { AddDeleteIcon = true; string icon = ""; string title = ""; string link = ""; string backPage = EkFunctions.UrlEncode(Request.Url.ToString()); //For Each item As AxMenuItemData In menu_item_data foreach (AxMenuItemData item in menu.Item) { if (item == null) { continue; } if ((Convert.ToInt32(item.ItemType) == 4) && (m_strPageAction == "removeitems")) { // submenus need to be deleted individually so they shouldn't show up in this list! continue; } MenuItemCount++; dr = dt.NewRow(); if (m_strPageAction == "removeitems") { dr["CHECK"] = "<input type=\"checkbox\" id=\"frm_content_ids\" name=\"frm_content_ids\" value=\"" + item.ID + "\" onclick=\"checkAll(\'frm_content_ids\',true);\">"; } //backPage = EkFunctions.UrlEncode("Action=viewcontent&view=item&menuid=" & MenuId) //link = "<a href='content.aspx?action=View&LangType=" & item.ContentLanguage & "&id=" & item.ID & "&callerpage=menu.aspx&origurl=" & backPage & "' title='" & title & "'>" & item.ItemTitle & "</a>" title = (string)(m_refMsg.GetMessage("generic View") + " \"" + item.ItemTitle.Replace(" \'", "`") + "\""); string editmenuitemurl; editmenuitemurl = (string)("collections.aspx?action=EditMenuItem&nid=" + MenuId + "&id=" + item.ID + "&Ty=" + item.ItemType + "&back=" + backPage); link = "<a href=\'" + editmenuitemurl + " \'>" + item.ItemTitle + "</a>"; Collection iteminfo = null; string assetimageurl = ""; if ((Convert.ToInt32(item.ItemType) == 1)) { if (item.ItemSubType == 8) { iteminfo = m_refContentApi.EkContentRef.GetMenuItemByID(item.ItemID, item.ID, false); // this is a DMS asset so we have to look up the icon for it because the menu api doesn't have this Ektron.Cms.ContentData assetcontentdata = m_refContent.GetContentById(Convert.ToInt64(iteminfo["ItemID"]), Ektron.Cms.Content.EkContent.ContentResultType.Published); AssetManagement.AssetManagementService service = new AssetManagement.AssetManagementService(); Ektron.ASM.AssetConfig.AssetFileInformation fileInfo = service.GetFileInformation(assetcontentdata.AssetData.Version); assetimageurl = fileInfo.ImageUrl; icon = "<img src=\"" + fileInfo.ImageUrl + "\" /> "; } else { icon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/contentHtml.png" + "\" /> "; } } else if ((Convert.ToInt32(item.ItemType) == 2)) { icon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/contentForm.png" + "\" /> "; } else if ((Convert.ToInt32(item.ItemType) == 4)) { icon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/menu.png" + "\" /> "; link = "<a href=\'menu.aspx?Action=viewcontent&menuid=" + item.ID + "&treeViewId=-3" + "\'>" + item.ItemTitle + "</a>"; } else if ((Convert.ToInt32(item.ItemType) == 5)) { icon = "<img src=\"" + m_refContentApi.AppPath + "images/ui/icons/link.png" + "\" /> "; } if ((Convert.ToInt32(item.ItemType) == 1) || (Convert.ToInt32(item.ItemType) == 2)) { if (iteminfo == null) { iteminfo = m_refContentApi.EkContentRef.GetMenuItemByID(item.ItemID, item.ID, false); } int itemtype = (int)item.ItemType; if (itemtype == 2) { //For Library Items , ItemID key is a libraryId instead of ContentID and ItemType has to be passed. // this is contenttype 7 for the menu generator. itemtype = 7; dr["TITLE"] = m_refContentApi.GetDmsContextMenuHTML(Convert.ToInt64(iteminfo["ContentID"]), Convert.ToInt64(iteminfo["ContentLanguage"]), itemtype, item.ItemContentSubType, item.ItemTitle, (string)(m_refMsg.GetMessage("edit menu items title") + " " + item.ItemTitle), editmenuitemurl, "", assetimageurl); } else { dr["TITLE"] = m_refContentApi.GetDmsContextMenuHTML(Convert.ToInt64(iteminfo["ItemID"]), Convert.ToInt64(iteminfo["ContentLanguage"]), Convert.ToInt64(iteminfo["ContentType"]), item.ItemContentSubType, item.ItemTitle, (string)(m_refMsg.GetMessage("edit menu items title") + " " + item.ItemTitle), editmenuitemurl, "", assetimageurl); } if ((Convert.ToInt32(item.ItemType) == 1) && (Convert.ToInt32(item.ItemSubType) == 8) && (string.IsNullOrEmpty(iteminfo["ItemLink"].ToString()))) { //Using the contentblock control to get the exact quicklink for asset which is not in contendata used above. //This is because the contentdata or assetdata has nothing to show difference btw assets and privateassets. //Regarding the defect #54892 Ektron.Cms.Controls.ContentBlock cBlock = new Ektron.Cms.Controls.ContentBlock(); cBlock.Page = this.Page; cBlock.DefaultContentID = Convert.ToInt64(iteminfo["ItemID"]); cBlock.Fill(); dr["URL"] = cBlock.EkItem.QuickLink; } else { dr["URL"] = iteminfo["ItemLink"]; } } else { dr["TITLE"] = icon + link; dr["URL"] = item.ItemLink; } dr["ID"] = item.ID; dr["LANGUAGE"] = item.ContentLanguage; dt.Rows.Add(dr); } } DataView dv = new DataView(dt); MenuItemList.DataSource = dv; MenuItemList.DataBind(); }
private string GetOldFileName(long id) { Ektron.Cms.API.Content.Content cContent = new Ektron.Cms.API.Content.Content(); ContentData cData = cContent.GetContent(id, Ektron.Cms.ContentAPI.ContentResultType.Published); if (cData != null) { AssetManagement.AssetManagementService assetmanagementService = new AssetManagement.AssetManagementService(); Ektron.ASM.AssetConfig.AssetData assetData = assetmanagementService.GetAssetData(cData.AssetData.Id); if (assetData != null) return assetData.Handle; } return ""; }
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); } } }
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 EditContentHtmlScripts() { StringBuilder sbHtml = new StringBuilder(); string strAssetID = ""; string strSnippet = ""; string strPath = ""; string editLiveCSS = ""; long copyContID = 0; bool addFileUpload = false; string MenuItemType; if (content_stylesheet.Length > 0) { strPath = (string)(GetServerPath() + SitePath + content_stylesheet); editLiveCSS = (string)("&css=" + content_stylesheet); } if (!String.IsNullOrEmpty (Request.QueryString["content_id"])) { //this key is also used for media asset translated. copyContID = Convert.ToInt64(Request.QueryString["content_id"]); } isOfficeDoc.Value = "false"; MultiupLoadTitleMsg.Text = ""; content_title.Visible = true; this.type.Value = ""; if ((IsMac) && !(Utilities.IsAsset(lContentType, strAssetID))) { if (content_edit_data != null && (content_edit_data.Type == 1 || content_edit_data.Type == 3) && (content_edit_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_edit_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData || content_edit_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)) { string typeaction = Request.QueryString["type"]; if ((typeaction != null) && typeaction.ToLower() == "update") { isOfficeDoc.Value = "true"; } HtmlGenericControl linebreak = new HtmlGenericControl("div"); linebreak.InnerHtml = "<br /><br />"; m_ctlContentPane.Controls.Add(linebreak); HtmlGenericControl htmlGen = new HtmlGenericControl("span"); htmlGen.InnerHtml = Ektron.Cms.PageBuilder.PageData.RendertoString(content_edit_data.Html); m_ctlContentPane.Controls.Add(htmlGen); } else if ("ContentDesigner" == m_SelectedEditControl) { m_ctlContentDesigner.Visible = true; m_ctlContentDesigner.Width = new Unit(editorWidthUnits, editorWidthUnitType); m_ctlContentDesigner.Height = new Unit(635, UnitType.Pixel); if (content_stylesheet.Length > 0) { m_ctlContentDesigner.Stylesheet = strPath; } if (editorPackage.Length > 0) { m_ctlContentDesigner.LoadPackage(m_refContApi, editorPackage); m_ctlContentDesigner.DataDocumentXml = m_strContentHtml; } else { m_ctlContentDesigner.Content = m_strContentHtml; } m_ctlContentValidator.ValidationExpression = Utilities.BuildRegexToCheckMaxLength(iMaxContLength); m_ctlContentValidator.Visible = true; } else { if (!IsBrowserIE) { sbHtml.Append("<input type=\"hidden\" name=\"ephox\" id=\"ephox\" value=\"true\">"); sbHtml.Append("<input type=\"hidden\" name=\"selectedtext\" id=\"selectedtext\">"); sbHtml.Append("<input type=\"hidden\" name=\"selectedhtml\" id=\"selectedhtml\">"); System.Text.StringBuilder strJSEditLive = new System.Text.StringBuilder(); strJSEditLive.Append("<script language=\"JavaScript\" src=\"" + this.AppeWebPath + "editlivejava/editlivejava.js\"></script>" + "\r\n"); sbHtml.Append("<input type=\"hidden\" name=\"EphoxContent\" id=\"EphoxContent\" value=\"" + EkFunctions.UrlEncode(Server.HtmlDecode(m_strContentHtml)) + "\">"); strJSEditLive.Append("<script language=\"JavaScript\">" + "\r\n"); strJSEditLive.Append(" var strContent;"); strJSEditLive.Append(" elx1 = new EditLiveJava(\"content_html\", \"700\", \"400\");"); strJSEditLive.Append(" elx1.setXMLURL(\"" + this.AppeWebPath + "editlivejava/config.aspx?apppath=" + this.AppPath + "&sitepath=" + this.SitePath + editLiveCSS + "\");"); strJSEditLive.Append(" elx1.setOutputCharset(\"UTF-8\");"); strJSEditLive.Append(" elx1.setBody(document.forms[0].EphoxContent.value);"); strJSEditLive.Append(" elx1.setDownloadDirectory(\"" + this.AppeWebPath + "editlivejava\");"); strJSEditLive.Append(" elx1.setLocalDeployment(false);"); strJSEditLive.Append(" elx1.setCookie(\"\");"); strJSEditLive.Append(" elx1.show();" + "\r\n"); strJSEditLive.Append(" </script>" + "\r\n"); sbHtml.Append(strJSEditLive.ToString()); } else { sbHtml.Append("<input type=\"hidden\" name=\"ephox\" id=\"ephox\" value=\"false\">"); sbHtml.Append("<textarea id=\"content_html\" name=\"content_html\" cols=\"90\" rows=\"24\" ID=\"Textarea2\">" + m_strContentHtml + "</textarea>"); } Literal litSnippet = new Literal(); litSnippet.ID = "ephox_control_literal"; litSnippet.Text = sbHtml.ToString(); m_ctlContentPane.Controls.Add(litSnippet); } } else { sbHtml.Append("<input type=\"hidden\" name=\"ephox\" id=\"ephox\" value=\"false\">"); strAssetID = asset_info["AssetID"].ToString(); if (content_edit_data != null && (content_edit_data.Type == 1 || content_edit_data.Type == 3) && (content_edit_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_edit_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData || content_edit_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.WebEvent)) { string typeaction = Request.QueryString["type"]; if ((typeaction != null) && typeaction.ToLower() == "update") { isOfficeDoc.Value = "true"; } HtmlGenericControl linebreak = new HtmlGenericControl("div"); linebreak.InnerHtml = "<br /><br />"; m_ctlContentPane.Controls.Add(linebreak); HtmlGenericControl htmlGen = new HtmlGenericControl("span"); htmlGen.InnerHtml = Ektron.Cms.PageBuilder.PageData.RendertoString(content_edit_data.Html); m_ctlContentPane.Controls.Add(htmlGen); } else if (Utilities.IsAsset(lContentType, strAssetID)) { if (m_strType == "multiple,add") { bool isUrlAliasRequired = false; FolderData fdTmp = this.m_refContApi.EkContentRef.GetFolderById(Int64.Parse(Request.QueryString["folderid"])); Ektron.Cms.UrlAliasing.UrlAliasSettingsApi m_urlAliasSettings = new Ektron.Cms.UrlAliasing.UrlAliasSettingsApi(); if (m_urlAliasSettings.IsManualAliasEnabled) { if (fdTmp.AliasRequired) { isUrlAliasRequired = true; } } jsManualAliasAlert.Text = m_refMsg.GetMessage("js:url aliasing is required dms mupload");// "Url aliasing is required for this folder. Non-image assets will be uploaded but unpublished."; if (Request.Cookies[DMSCookieName] != null && !string.IsNullOrEmpty(Request.Cookies[DMSCookieName].Value)) { if (Request.Cookies[DMSCookieName].Value == "2010") { if (isUrlAliasRequired) { jsfolderRequireManualAlias2010.Text = "true"; } Button btnMupload = new Button(); //btnMupload.ClientIDMode = System.Web.UI.ClientIDMode.Static; btnMupload.ID = "btnMupload"; btnMupload.Text = "Upload"; btnMupload.Attributes.Add("onclick", "return DocumentUploadOffice2010()"); m_ctlContentPane.Controls.Add(btnMupload); } else { if (isUrlAliasRequired) { jsfolderRequireManualAlias.Text = "true"; } HiddenField hfTmp = new HiddenField(); hfTmp.ID = "FromMenuMultiDMS"; hfTmp.Value = ""; m_ctlContentPane.Controls.Add(hfTmp); } } HtmlGenericControl linebreak = new HtmlGenericControl("div"); linebreak.InnerHtml += "<br /><br />" + "\r\n"; linebreak.InnerHtml += "<div id=idMultipleView style=\'display:none\'>"; linebreak.InnerHtml += "<script type=\"text/javascript\">" + "\r\n"; linebreak.InnerHtml += " AC_AX_RunContent(\'id\',\'idUploadCtl\',\'name\',\'idUploadCtl\',\'classid\',\'CLSID:07B06095-5687-4d13-9E32-12B4259C9813\',\'width\',\'100%\',\'height\',\'350px\');" + "\r\n"; linebreak.InnerHtml += "\r\n" + " </script> </div> " + "\r\n"; linebreak.InnerHtml += "<br /><br />"; linebreak.InnerHtml += "<div> " + m_refMsg.GetMessage("lbl valid file types") + DocumentManagerData.Instance.FileTypes + "</div>"; m_ctlContentPane.Controls.Add(linebreak); strSnippet += "\r\n" + "<script language=\"JavaScript\">" + "\r\n"; strSnippet += "MultipleUploadView();" + "\r\n"; strSnippet += "\r\n" + "</script>"; content_title.Visible = false; MultiupLoadTitleMsg.Text = m_refMsg.GetMessage("lbl msg for multiupload title"); this.type.Value = "multiple,add"; } else if (strAssetID.Length == 0) { HtmlGenericControl linebreak = new HtmlGenericControl("div"); linebreak.InnerHtml = "<br /><br />"; m_ctlContentPane.Controls.Add(linebreak); HtmlGenericControl htmlGen = new HtmlGenericControl("span"); htmlGen.InnerHtml = m_refMsg.GetMessage("lbl upload file"); m_ctlContentPane.Controls.Add(htmlGen); HtmlGenericControl fileUploadWrapper = new HtmlGenericControl("span"); fileUploadWrapper.ID = "fileUploadWrapper"; System.Web.UI.WebControls.FileUpload fileUpload = new System.Web.UI.WebControls.FileUpload(); fileUpload.ID = "fileupload"; fileUploadWrapper.Controls.Add(fileUpload); m_ctlContentPane.Controls.Add(fileUploadWrapper); oldfilename.Value = ""; addFileUpload = true; this.type.Value = "add"; } else { if (lContentType == Ektron.Cms.Common.EkConstants.CMSContentType_Media) { Multimedia_commonparams mediaParams; mediaParams = (Multimedia_commonparams)(LoadControl("controls/media/commonparams.ascx")); mediaParams.ID = m_strContentTitle; if (m_strType == "add" && copyContID != 0) { mediaParams.ContentHtml = this.m_refContent.CreateMediaXML(content_data.AssetData, m_intContentFolder); mediaParams.AssetID = content_data.AssetData.Id; mediaParams.MimeType = content_data.AssetData.MimeType; mediaParams.AssetVersion = content_data.AssetData.Version; mediaParams.AssetFileName = m_refContApi.GetViewUrl(content_data.AssetData.Id, Ektron.Cms.Common.EkConstants.CMSContentType_Media); } else { mediaParams.ContentHtml = m_strContentHtml; mediaParams.AssetID = strAssetID; mediaParams.MimeType = asset_info["MimeType"].ToString(); mediaParams.AssetVersion = asset_info["AssetVersion"].ToString(); mediaParams.AssetFileName = m_refContApi.RequestInformationRef.AssetPath + m_refContApi.EkContentRef.GetFolderParentFolderIdRecursive(content_edit_data.FolderId).Replace(",", "/") + "/" + content_edit_data.AssetData.Id + "." + content_edit_data.AssetData.FileExtension; mediaParams.AssetFileName = (content_edit_data.IsPrivate ? m_refContApi.RequestInformationRef.SitePath + "PrivateAssets/" : m_refContApi.RequestInformationRef.AssetPath) + m_refContApi.EkContentRef.GetFolderParentFolderIdRecursive(content_edit_data.FolderId).Replace(",", "/") + "/" + content_edit_data.AssetData.Id + "." + content_edit_data.AssetData.FileExtension; } m_ctlContentPane.Controls.Add(mediaParams); } else { //check for type = 'add' here if (m_strType == "add") { HtmlGenericControl linebreak = new HtmlGenericControl("div"); linebreak.InnerHtml = "<br /><br />"; m_ctlContentPane.Controls.Add(linebreak); HtmlGenericControl htmlGen = new HtmlGenericControl("span"); htmlGen.InnerHtml = m_refMsg.GetMessage("lbl upload file"); HtmlGenericControl fileUploadWrapper = new HtmlGenericControl("span"); fileUploadWrapper.ID = "fileUploadWrapper"; System.Web.UI.WebControls.FileUpload fileUpload = new System.Web.UI.WebControls.FileUpload(); fileUpload.ID = "fileupload"; fileUploadWrapper.Controls.Add(fileUpload); m_ctlContentPane.Controls.Add(fileUploadWrapper); oldfilename.Value = ""; addFileUpload = true; } else { if (Ektron.ASM.AssetConfig.ConfigManager.IsOfficeDoc(content_edit_data.AssetData.FileExtension)) { AssetManagement.AssetManagementService assetmanagementService = new AssetManagement.AssetManagementService(); Ektron.ASM.AssetConfig.AssetData assetData = assetmanagementService.GetAssetData(content_edit_data.AssetData.Id); string strfilename; strfilename = (string)(GetFolderPath(content_edit_data.FolderId) + assetData.Handle); filename.Value = strfilename; HtmlGenericControl linebreak = new HtmlGenericControl("div"); linebreak.InnerHtml = "<br /><br /> Currently uploaded file: " + assetData.Handle + " <br /><br />"; m_ctlContentPane.Controls.Add(linebreak); m_ctlContentPane.Controls.Add(linebreak); HtmlGenericControl htmlGen = new HtmlGenericControl("span"); htmlGen.InnerHtml = m_refMsg.GetMessage("lbl upload file"); m_ctlContentPane.Controls.Add(htmlGen); HtmlGenericControl fileUploadWrapper = new HtmlGenericControl("span"); fileUploadWrapper.ID = "fileUploadWrapper"; System.Web.UI.WebControls.FileUpload fileUpload = new System.Web.UI.WebControls.FileUpload(); fileUpload.ID = "fileupload"; fileUploadWrapper.Controls.Add(fileUpload); m_ctlContentPane.Controls.Add(fileUploadWrapper); oldfilename.Value = assetData.Handle; //This hidden field is used to hide content tab if office is not installed or browser is non-ie, else show content tab with browse button isOfficeDoc.Value = "true"; } else { AssetManagement.AssetManagementService assetmanagementService = new AssetManagement.AssetManagementService(); Ektron.ASM.AssetConfig.AssetData assetData = assetmanagementService.GetAssetData(asset_info["AssetID"].ToString()); HtmlGenericControl linebreak = new HtmlGenericControl("div"); linebreak.InnerHtml = "<br /><br /> Currently uploaded file: " + assetData.Handle + " <br /><br />"; m_ctlContentPane.Controls.Add(linebreak); m_ctlContentPane.Controls.Add(linebreak); HtmlGenericControl htmlGen = new HtmlGenericControl("span"); htmlGen.InnerHtml = m_refMsg.GetMessage("lbl upload file"); m_ctlContentPane.Controls.Add(htmlGen); HtmlGenericControl fileUploadWrapper = new HtmlGenericControl("span"); fileUploadWrapper.ID = "fileUploadWrapper"; System.Web.UI.WebControls.FileUpload fileUpload = new System.Web.UI.WebControls.FileUpload(); fileUpload.ID = "fileupload"; fileUploadWrapper.Controls.Add(fileUpload); m_ctlContentPane.Controls.Add(fileUploadWrapper); oldfilename.Value = assetData.Handle; } MenuItemType = Request.QueryString["menuItemType"]; if ((MenuItemType != null) && MenuItemType.ToLower() == "editproperties") { isOfficeDoc.Value = "true"; } } } } sbHtml.Append(strSnippet); sbHtml.Append("<input type=\"hidden\" id=\"content_html\" name=\"content_html\" value=\"" + EkFunctions.HtmlEncode(m_strContentHtml) + "\">"); //fix for 32909 - in case of Add multimedia file to Menu, lContentType is CMSContentType_Media but //since it is add we show the fileupload browse button, not the DragDropExplorer control if ((lContentType == Ektron.Cms.Common.EkConstants.CMSContentType_Media) && (addFileUpload == false) && m_strType == "update") { HtmlGenericControl DragDropContainer = new HtmlGenericControl("div"); DragDropContainer.ID = "DragDropContainer"; DragDropContainer.Style.Add("width", "35%"); string multiUploadAssetID = "&AssetID=" + m_refContentId.ToString(); string multiUploadTaxString = string.Empty; TaxonomyBaseData[] taxonomies = m_refContent.ReadAllAssignedCategory(m_refContentId); if (!((taxonomies == null)) && taxonomies.Length > 0) { multiUploadTaxString = "&TaxonomyId=" + taxonomies[0].Id.ToString(); } Literal uploaderSnippet = new Literal(); uploaderSnippet.ID = "UploadSnippet"; editaction.Value = m_strType; uploaderSnippet.Text = m_refMsg.GetMessage("lbl upload file replace") + ": " + "<a href=\"" + m_refContApi.AppPath + "DragDropCtl.aspx?id=" + m_intContentFolder.ToString() + multiUploadAssetID + multiUploadTaxString + "&lang_id=" + m_intContentLanguage.ToString() + "&hideMultiple=true&forceExtension=true&EkTB_iframe=true&height=120&width=500&refreshCaller=true&scrolling=false&modal=true\" class=\"ek_thickbox\" title=\"" + m_refMsg.GetMessage("Document Management System") + "\"><img id=\"DeskTopHelp\" title= \"" + m_refMsg.GetMessage("alt add assets text") + "\" border=\"0\" src=\"images/UI/Icons/Import.png\"/></a>"; DragDropContainer.Controls.Add(uploaderSnippet); m_ctlContentPane.Controls.Add(DragDropContainer); } Literal litSnippet = new Literal(); litSnippet.ID = "ContentHtml"; litSnippet.Text = sbHtml.ToString(); m_ctlContentPane.Controls.Add(litSnippet); } else { if (m_strType == "add" && (content_data != null) && (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"; } HtmlInputHidden ctlEphox = new HtmlInputHidden(); ctlEphox.ID = "ephox"; ctlEphox.Value = "false"; m_ctlContentPane.Controls.Add(ctlEphox); if ("ContentDesigner" == m_SelectedEditControl) { m_ctlContentDesigner.Visible = true; m_ctlContentDesigner.Width = new Unit(editorWidthUnits, editorWidthUnitType); m_ctlContentDesigner.Height = new Unit(635, UnitType.Pixel); if (content_stylesheet.Length > 0) { m_ctlContentDesigner.Stylesheet = strPath; } if (editorPackage.Length > 0) { m_ctlContentDesigner.LoadPackage(m_refContApi, editorPackage); m_ctlContentDesigner.DataDocumentXml = m_strContentHtml; } else { m_ctlContentDesigner.Content = m_strContentHtml; } m_ctlContentValidator.ValidationExpression = Utilities.BuildRegexToCheckMaxLength(iMaxContLength); m_ctlContentValidator.Visible = true; } else { Ektron.Cms.Controls.HtmlEditor ctlEditor = new Ektron.Cms.Controls.HtmlEditor(); ctlEditor.WorkareaMode(2); ctlEditor.ID = "content_html"; ctlEditor.Width = new Unit(editorWidthUnits, editorWidthUnitType); ctlEditor.Height = new Unit(100, UnitType.Percentage); ctlEditor.Path = AppeWebPath; ctlEditor.MaxContentSize = iMaxContLength; ctlEditor.Locale = AppeWebPath + "locale" + AppLocaleString + "b.xml"; if (editorPackage.Length > 0) { Ektron.WebEditorNet2.eWebEditProField objField; objField = new Ektron.WebEditorNet2.eWebEditProField(); objField.Name = "datadesignpackage"; objField.SetContentType = "datadesignpackage"; objField.GetContentType = ""; objField.Text = editorPackage; ctlEditor.Fields.Add(objField); objField = new Ektron.WebEditorNet2.eWebEditProField(); objField.Name = "datadocumentxml"; objField.SetContentType = "datadocumentxml"; objField.GetContentType = ""; // content is retrieved manually objField.Text = m_strContentHtml; ctlEditor.Fields.Add(objField); objField = null; } else { ctlEditor.Text = m_strContentHtml; } System.Web.UI.HtmlControls.HtmlGenericControl eWebEditProWrapper = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV"); eWebEditProWrapper.Attributes.Add("class", "ewebeditproWrapper ewebeditpro_dvContent"); eWebEditProWrapper.Controls.Add(ctlEditor); m_ctlContentPane.Controls.Add(eWebEditProWrapper); } } } // fix for Defect: #43308, why output this tab if you are jsut going to hide it? We always hide it for // office docs, so...IE ONLY //if (isOfficeDoc.Value == "true" && IsBrowserIE) //{ // phContent.Visible = false; // phEditContent.Visible = false; //} if (!String.IsNullOrEmpty(m_strContentHtml)) { if (m_ctlContentDesigner != null) { m_ctlContentDesigner.CurrentCharCount = m_strContentHtml.Length; if (m_ctlContentDesigner.CurrentCharCount > m_ctlContentDesigner.WordPasteThreshold) { m_ctlContentDesigner.ShowPasteWarning = false; WarningMessage.Visible = true; WarningMessage.Text = m_refMsg.GetMessage("WordPasteWarningMessage"); } } } }