public CmsMenuItem GetMenuItem(string id, string parentId, string menuId) { BaseService.CheckLoginAndLicense(); CmsMenuItem item = null; if (id == null) { item = new CmsMenuItem(); item.Site = SessionObject.CurrentSite; item.Menu = new CmsMenu(); item.Menu.ID = new Guid(menuId); if (parentId != null && parentId != "") { item.ParentMenuItem = new CmsMenuItem(); item.ParentMenuItem.ID = new Guid(parentId); item.OrderingNumber = item.ParentMenuItem.GetMaxItemOrderNumber() + 1; } else { item.OrderingNumber = item.Menu.GetMaxItemOrderNumber() + 1; } } else { item = BaseObject.GetById <CmsMenuItem>(new Guid(id)); } return(item); }
public ViewResult Edit(int?id) { IEnumerable <SelectListItem> menuTypes = GetMenuTypes(); if (null != id) { CmsMenuItem menuItem = menuService.LoadMenuItem(id.Value); if (menuItem.Entry == null) { menuItem.Entry = new CmsPage(); } return(View(new ViewModelMenuItem { MenuItem = menuItem, MenuTypes = menuTypes })); } // load empty screen return(View(new ViewModelMenuItem { MenuItem = new CmsMenuItem(), MenuTypes = menuTypes })); }
public BaseCollection <CmsMenuItem> GetMenuItems(string menuId, string parentId, string parentPath, string sort) { BaseService.CheckLoginAndLicense(); if ((parentId == null || parentId == "") && (parentPath != null && parentPath != "")) { //haal folder id op vanuit path //path wordt gebruikt als er vanuit de breadcrumb wordt genavigeerd string where = String.Format("CompletePath = '{0}'", parentPath); CmsMenuItem item = BaseObject.GetFirst <CmsMenuItem>(where); parentId = item.ID.ToString(); } //if (sort == "" || sort == null) //{ // sort = "OrderingNumber"; //} string whereItems = String.Format("FK_Menu = '{0}' AND FK_Parent_MenuItem='{1}'", menuId, parentId); if (parentId == null || parentId == "" || parentId == Guid.Empty.ToString()) { whereItems = String.Format("FK_Menu = '{0}' AND FK_Parent_MenuItem Is Null", menuId); } BaseCollection <CmsMenuItem> itemslist = BaseCollection <CmsMenuItem> .Get(whereItems, "OrderingNumber"); return(itemslist); }
public void CopyMenuItem(string itemId, string newName) { BaseService.CheckLoginAndLicense(); CmsMenuItem item = BaseObject.GetById <CmsMenuItem>(new Guid(itemId)); item.Copy(newName); }
public void DeleteMenuItem(string id) { BaseService.CheckLoginAndLicense(); CmsMenuItem item = BaseObject.GetById <CmsMenuItem>(new Guid(id)); item.Delete(); }
public void SaveMenuItem(CmsMenuItem item) { if (item.Entry != null && item.Entry.Id == 0) { item.Entry = null; } menuData.SaveMenuItem(item); }
public void SaveMenuItem(CmsMenuItem item) { if (item.Page != null && item.Page.Id == 0) { item.Page = null; } Ctx.MenuItems.Add(item); Ctx.SaveChanges(); }
public static string BuildMenuLink(this UrlHelper urlHelper, CmsMenuItem item) { if (item.IsExternalUrl) { return(item.NavigateUrl); } return(urlHelper.Action("Content", "Home", new { id = item.Entry.Id, name = item.Entry.Alias })); }
public static string BuildMenuLink(this UrlHelper urlHelper, CmsMenuItem item) { if (item.IsExternalUrl) { return item.NavigateUrl; } return urlHelper.Action("Content", "Home", new {id = item.Entry.Id, name = item.Entry.Alias}); }
public static string BuildMenuLink(this UrlHelper urlHelper, CmsMenuItem item) { if (item.IsExternalUrl) { return(item.NavigateUrl); } if (item.Page == null) { return(urlHelper.Action("Index", "Home")); } return(urlHelper.Action("Page", "Home", new { id = item.Page.Id, name = item.Page.Alias })); }
public CmsMenuItem SaveMenuItem(CmsMenuItem obj) { BaseService.CheckLoginAndLicense(); obj.Site = SessionObject.CurrentSite; if (obj.ParentMenuItem != null && obj.ParentMenuItem.ID == Guid.Empty) { obj.ParentMenuItem = null; } obj.Save(); return(obj); }
private string createHyperLink(CmsMenuItem menuItem) { string html = ""; if (menuItem.Target != "" || menuItem.Target != "_self") { html = String.Format("<a href='{0}' title='{1}' target='{2}' >", menuItem.Url, menuItem.Title, menuItem.Target); } else { html = String.Format("<a href='{0}' title='{1}'>", menuItem.Url, menuItem.Title); } return(html); }
public void UpdateOrderingNummerItem(string itemId, string parentItemId, string menuId, int newOrderingNumber) { BaseService.CheckLoginAndLicense(); if (parentItemId != "") { CmsMenuItem item = BaseObject.GetById <CmsMenuItem>(new Guid(parentItemId)); item.MoveItems(itemId, newOrderingNumber); } else { CmsMenu menu = BaseObject.GetById <CmsMenu>(new Guid(menuId)); menu.MoveItems(itemId, newOrderingNumber); } }
private string GetSubItemsHtml(string menuTemplate, string menuItemTemplate, CmsMenuItem parentItem) { string subItemsHtml = ""; string subMenuHtml = menuTemplate; foreach (CmsMenuItem subItem in parentItem.GetSubMenuItems()) { string subItemHtml = menuItemTemplate; subItemHtml = subItemHtml.Replace("{MenuItem.Name}", subItem.Name); subItemHtml = subItemHtml.Replace("{MenuItem.Title}", subItem.Title); subItemHtml = subItemHtml.Replace("{MenuItem.Url}", subItem.Url); subItemHtml = subItemHtml.Replace("{MenuItem.Target}", subItem.Target); subItemHtml = subItemHtml.Replace("{MenuItem.CssClass}", subItem.CssClass); subItemHtml = subItemHtml.Replace("{MenuItem.Link}", createHyperLink(subItem)); subItemHtml = subItemHtml.Replace("{/MenuItem.Link}", "</a>"); subItemHtml = subItemHtml.Replace("{MenuItem.ImageUrl}", parentItem.ImageUrl); subItemHtml = subItemHtml.Replace("{MenuItem.ImageHoverUrl}", parentItem.ImageHoverUrl); subItemHtml = subItemHtml.Replace("{MenuItem.ImageActiveUrl}", parentItem.ImageActiveUrl); string subSubItemsHtml = GetSubItemsHtml(menuTemplate, menuItemTemplate, subItem); subItemHtml = subItemHtml.Replace("{MenuItem.ChildItems}", subSubItemsHtml); //if (subSubItemsHtml != "") //{ // subMenuHtml = subMenuHtml.Replace("<!--{MenuItems}-->" + menuItemTemplate + "<!--{/MenuItems}-->", subSubItemsHtml); // subMenuHtml = subMenuHtml.Replace("{MenuItems}" + menuItemTemplate + "{/MenuItems}", subSubItemsHtml); // subItemHtml += subMenuHtml; //} subItemsHtml += subItemHtml; } if (subItemsHtml != "") { subMenuHtml = subMenuHtml.Replace("<!--{MenuItems}-->" + menuItemTemplate + "<!--{/MenuItems}-->", subItemsHtml); subMenuHtml = subMenuHtml.Replace("{MenuItems}" + menuItemTemplate + "{/MenuItems}", subItemsHtml); } else { subMenuHtml = ""; } return(subMenuHtml); }
public void SaveMenuItem(CmsMenuItem item) { base.Save(item); }
private string GetSubItemsHtml(string subMenuTemplate, string subItemTemplate, CmsMenuItem mainItem) { string subItemsHtml = ""; string subMenuHtml = subMenuTemplate; foreach (CmsMenuItem subItem in mainItem.GetSubMenuItems()) { string subItemHtml = subItemTemplate; subItemHtml = subItemHtml.Replace("{SubItem.Name}", subItem.Name); subItemHtml = subItemHtml.Replace("{SubItem.Title}", subItem.Title); subItemHtml = subItemHtml.Replace("{SubItem.Url}", subItem.Url); subItemHtml = subItemHtml.Replace("{SubItem.Target}", subItem.Target); subItemHtml = subItemHtml.Replace("{SubItem.Link}", createHyperLink(subItem)); subItemHtml = subItemHtml.Replace("{/SubItem.Link}", "</a>"); subItemHtml = subItemHtml.Replace("{SubItem.ImageUrl}", mainItem.ImageUrl); subItemHtml = subItemHtml.Replace("{SubItem.ImageHoverUrl}", mainItem.ImageHoverUrl); subItemHtml = subItemHtml.Replace("{SubItem.ImageActiveUrl}", mainItem.ImageActiveUrl); string subSubItemsHtml = GetSubItemsHtml(subMenuTemplate, subItemTemplate, subItem); if (subSubItemsHtml != "") { subMenuHtml = subMenuHtml.Replace("<!--{SubMenuItems}-->" + subItemTemplate + "<!--{/SubMenuItems}-->", subSubItemsHtml); subMenuHtml = subMenuHtml.Replace("{SubMenuItems}" + subItemTemplate + "{/SubMenuItems}", subSubItemsHtml); subItemHtml += subMenuHtml; } subItemsHtml += subItemHtml; } if (subItemsHtml != "") { subMenuHtml = subMenuHtml.Replace("<!--{SubMenuItems}-->" + subItemTemplate + "<!--{/SubMenuItems}-->", subItemsHtml); subMenuHtml = subMenuHtml.Replace("{SubMenuItems}" + subItemTemplate + "{/SubMenuItems}", subItemsHtml); } else { subMenuHtml = ""; } return(subMenuHtml); }