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(); }
protected void Page_Load(object sender, EventArgs e) { MsgHelper = new EkMessageHelper(m_refContentApi.RequestInformationRef); StyleHelper m_refStyle = new StyleHelper(); CommonApi m_refApi = new CommonApi(); ApplicationAPI AppUI = new ApplicationAPI(); long Id = Convert.ToInt64(Request.QueryString["id"]); MenuId = Convert.ToInt64(Request.QueryString["nid"]); FolderId = Convert.ToInt64(Request.QueryString["folderid"]); gtLinks = AppUI.EkContentRef.GetMenuItemByID(MenuId, Id, true); sitePath = AppUI.SitePath; AppPath = AppUI.AppPath; long t_ID = Convert.ToInt64(gtLinks["ID"]); string t_ItemType = gtLinks["ItemType"].ToString(); Int32 t_ContentLanguage = Convert.ToInt32(gtLinks["ContentLanguage"]); string t_iframe = ""; if (!string.IsNullOrEmpty(Request.QueryString["iframe"])) t_iframe = Request.QueryString["iframe"].ToString(); Title.Value = gtLinks["ItemTitle"].ToString(); if ((string)gtLinks["ItemType"] == "1") { litInfo.Text += "<tr><td class=\"label\" title=\"Link\">"; litInfo.Text += MsgHelper.GetMessage("lbl Link") + ":</td>"; litInfo.Text += "<td class=\"value\">"; litInfo.Text += "<input type=\"radio\" name=\"linkType\" value=\"0\" " + (((string)gtLinks["LinkType"] == "0" || (string)gtLinks["LinkType"] == "") ? "checked=\"checked\"" : "") + " title=\"QuickLink\" />" + MsgHelper.GetMessage("lbl QuickLink"); litInfo.Text += "<input type=\"radio\" name=\"linkType\" value=\"1\" " + ((string)gtLinks["LinkType"] == "1" ? "checked=\"checked\"" : "") + " title=\"Menu Template\" />" + MsgHelper.GetMessage("lbl Menu Template") + "</td></tr>"; } if ((Convert.ToInt32(t_ItemType) == 1) && (string.IsNullOrEmpty(gtLinks["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 #58344 Ektron.Cms.Controls.ContentBlock cBlock = new Ektron.Cms.Controls.ContentBlock(); cBlock.Page = this.Page; cBlock.DefaultContentID = Convert.ToInt64(gtLinks["ItemID"]); cBlock.Fill(); //urlLink.["URL"] = cBlock.EkItem.QuickLink; tdItemLink.Visible = false; tdURLLink.Visible = true; urlLink.Value = cBlock.EkItem.QuickLink; } if (t_ItemType != "5" && t_ItemType != "2") { if ((string)gtLinks["ItemLink"] != "") litInfo.Text += "<tr><td class=\"label\" title=\"Quick Link\">" + MsgHelper.GetMessage("lbl Quick Link") + ":</td><td class=\"readOnlyValue\">" + (string)gtLinks["ItemLink"] + "</td></tr>"; if ((string)gtLinks["FolderId"] != "") litInfo.Text += "<tr><td class=\"label\" title=\"Folder Id\">" + MsgHelper.GetMessage("lbl Folder ID") + ":</td><td class=\"readOnlyValue\">" + (string)gtLinks["FolderId"] + "</td></tr>"; } litImageLink.Text = MsgHelper.GetMessage("lbl Image Link"); litTitle.Text = m_refStyle.GetTitleBar(MsgHelper.GetMessage("edit Menu items title")); litHelp.Text = StyleHelper.ActionBarDivider + "<td>" + m_refStyle.GetHelpButton("editmenuitem", "") + "</td>"; litGenericTitle.Text = MsgHelper.GetMessage("generic title label"); if (Request.QueryString["back"] != "") litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", Request.QueryString["back"], MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "", StyleHelper.CancelButtonCssClass, true); else if (Request.QueryString["iframe"] == "true") litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/cancel.png", "#", MsgHelper.GetMessage("generic Cancel"), MsgHelper.GetMessage("generic Cancel"), "onclick=\"parent.CancelIframe();\"", StyleHelper.CancelButtonCssClass, true); else { if (m_refApi.TreeModel == 1) litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/back.png", "menutree.aspx?nid=" + MenuId, MsgHelper.GetMessage("alt back button text"), MsgHelper.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true); else litButtons.Text = m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/back.png", "collections.aspx?action=ViewMenu&nId=" + MenuId, MsgHelper.GetMessage("alt back button text"), MsgHelper.GetMessage("btn back"), "", StyleHelper.BackButtonCssClass, true); } litButtons.Text += m_refStyle.GetButtonEventsWCaption(AppUI.AppPath + "images/UI/Icons/save.png", "#", MsgHelper.GetMessage("alt save menu item"), MsgHelper.GetMessage("btn save"), "onclick=\"return SubmitForm(\'AddMenuItem\', \'VerifyAddMenuItem()\');\"", StyleHelper.SaveButtonCssClass, true); }