public void InitView() { MenuBarType view = View.PreloadType; if (view == MenuBarType.None) { view = MenuBarType.GenericCommunity; } if (UserContext.isAnonymous) { View.DisplaySessionTimeout(rootObject.CreateMenuBar(view)); } else { Boolean allowManage = false; ModuleMenu module = ModuleMenu.CreatePortalmodule(UserContext.UserTypeID); List <MenuBarType> views = GetAvailableViews(module); if (views.Count == 0) { View.NoPermission(); } else { if (!views.Contains(view)) { view = views[0]; } View.LoadAvailableTypes(views); allowManage = module.ManagePortalMenubar || module.ManageAdministrationMenubar || module.ManageCommunitiesMenubar; View.AllowCreate = allowManage; if (allowManage) { View.TopItemsnumber = 5; View.SubItemsnumber = 5; dtoMenubar dto = new dtoMenubar(); dto.MenuBarType = view; dto.Name = View.DefaultMenuName; View.MenuBar = dto; } else { View.NoPermission(); } } } }
public void SaveItem(dtoMenubar dto) { long IdMenubar = View.IdMenubar; if (UserContext.isAnonymous) { View.DisplaySessionTimeout(rootObject.EditMenuBar(IdMenubar, Service.GetMenubarType(IdMenubar))); } else { Menubar menubar = Service.SaveMenubar(dto, IdMenubar); if (menubar != null) { View.ChangeTreeItemName(dto, dto.Name, 0); } else { View.SaveError(); } } }
public void AddMenuBar() { if (UserContext.isAnonymous) { View.CreationError(); View.DisplaySessionTimeout(rootObject.CreateMenuBar(View.PreloadType)); } else { dtoMenubar dto = View.MenuBar; dto.Deleted = BaseStatusDeleted.None; dto.Status = ItemStatus.Draft; Menubar menubar = Service.CreateMenubar(dto, View.TopItemsnumber, View.SubItemsnumber); if (menubar == null) { View.CreationError(); } else { View.EditMenubar(menubar.Id, menubar.MenuBarType); } } }
public void EditActiveMenubar(long idMenubar, String menuBarName) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(rootObject.MenuBarList(View.CurrentView)); } else { dtoMenubar dto = Service.GetDtoMenubar(idMenubar); if (dto != null) { ModuleMenu module = ModuleMenu.CreatePortalmodule(UserContext.UserTypeID); Boolean allowManage = (dto.MenuBarType == MenuBarType.PortalAdministration) ? module.ManagePortalMenubar : (dto.MenuBarType == MenuBarType.GenericCommunity) ? module.ManageCommunitiesMenubar : (dto.MenuBarType == MenuBarType.Portal) ? module.ManageAdministrationMenubar : false; if (allowManage) { Menubar clone = Service.CloneMenubar(idMenubar, (menuBarName.Contains("{0}")) ? String.Format(menuBarName, dto.Name) : "[COPY] " + dto.Name); if (clone != null) { View.EditMenubar(clone.Id, clone.MenuBarType); } } } } }