public IActionResult EditContentSave(EditContentViewModel model) { if (ModelState.IsValid) { ICmsManager manager = new CmsManager(); IContentStore contentStore = manager.GetContentStore(model.RepositoryId); ContentItem item = contentStore.Items.Where(m => m.Id == model.Item.Id).FirstOrDefault(); IRepository repository = manager.GetRepositoryById(model.RepositoryId); model.ContentDefinition = repository.ContentDefinitions.Where(m => m.DefinitionId == model.DefinitionId).FirstOrDefault(); if (item == null) { item = FCms.Factory.ContentFactory.CreateContentByType(model.ContentDefinition); model.MapToModel(item, Request); contentStore.Items.Add(item); } else { model.MapToModel(contentStore.GetById((Guid)model.Item.Id), Request); } manager.SaveContentStore(contentStore); return(Redirect("/fcmsmanager/pagecontent/list?repositoryid=" + model.RepositoryId + "&definitionid=" + item.DefinitionId.ToString())); } return(View("Edit", new RepositoryViewModel())); }
public void InitTest() { Tools.DeleteCmsFile(); manager = CmsManager.Load(); Repository repository = new Repository() { Id = repositoryId, Name = repositoryName }; IContentDefinition definition = ContentDefinitionFactory.CreateContentDefinition(IContentDefinition.DefinitionType.String); definition.DefinitionId = definitionId; definition.Name = contentName; repository.ContentDefinitions.Add(definition); manager.Repositories.Add(repository); // filters manager.Filters.Add(new RegExFilter() { Id = regexFilterId, Name = "Email" }); manager.Filters.Add(new BooleanFilter() { Id = booleanFilterId, Name = "IsLoggedIn" }); manager.Save(); }
public IActionResult SavePost(RepositoryViewModel model) { if (ModelState.IsValid) { ICmsManager manager = new CmsManager(); IRepository repo; if (model.IsItANewRepository()) { repo = model.MapToModel(new Repository()); model.ApplyTemplate(repo); manager.AddRepository(repo); } else { try { int repoindex = manager.GetIndexById(model.Id.Value); repo = manager.Data.Repositories[repoindex]; model.MapToModel(repo); } catch (InvalidOperationException) { throw new Exception("The content definition not found"); } } manager.Save(); return(Redirect("/fcmsmanager/" + ViewModelHelpers.GetRepositoryBaseUrl(repo))); } return(View("Edit", new RepositoryViewModel())); }
public bool ItemList([FromUri] Guid guid, List <SortedEntityItem> list, [FromUri] string part = null) { Log.Add($"list for:{guid}, items:{list?.Count}"); if (list == null) { throw new ArgumentNullException(nameof(list)); } var versioning = BlockBuilder.Environment.PagePublishing; void InternalSave(VersioningActionInfo args) { var cms = new CmsManager(BlockBuilder.App, Log); var entity = cms.Read.AppState.List.One(guid); var sequence = list.Select(i => i.Index).ToArray(); var fields = part == ViewParts.ContentLower ? ViewParts.ContentPair : new[] { part }; cms.Entities.FieldListReorder(entity, fields, sequence, cms.EnablePublishing); } // use dnn versioning - items here are always part of list var context = DnnDynamicCode.Create(BlockBuilder, Log); versioning.DoInsidePublishing(context.Dnn.Module.ModuleID, context.Dnn.User.UserID, InternalSave); return(true); }
public IActionResult Edit(Guid repositoryid, Guid contentid) { ICmsManager manager = new CmsManager(); IRepository repository = manager.GetRepositoryById(repositoryid); if (repository == null) { return(Redirect("/fcmsmanager/home")); } IContentStore contentStore = manager.GetContentStore(repositoryid); EditContentViewModel model = new EditContentViewModel(); model.RepositoryName = repository.Name; model.Item = contentStore.Items.Where(m => m.Id == contentid).FirstOrDefault(); if (model.Item == null) { return(Redirect("/fcmsmanager/repository?d=" + contentid)); } model.ContentDefinition = repository.ContentDefinitions.Where(m => m.DefinitionId == model.Item.DefinitionId).FirstOrDefault(); model.RepositoryId = repositoryid; return(View("Edit", model)); }
public IActionResult Save(EditFilterViewModel model) { if (ModelState.IsValid) { ICmsManager manager = CmsManager.Load(); if (model.Id == null) { IFilter filtermodel = FCms.Factory.FilterFactory.CreateFilterByType((IFilter.FilterType)Enum.Parse(typeof(IFilter.FilterType), model.Type)); manager.Filters.Add(model.MapToModel(filtermodel)); } else { int repoindex = manager.Filters.Select((v, i) => new { filter = v, Index = i }).FirstOrDefault(x => x.filter.Id == model.Id)?.Index ?? -1; if (repoindex < 0) { throw new Exception("The filter definition not found"); } model.MapToModel(manager.Filters[repoindex]); } manager.Save(); return(Redirect("/fcmsmanager/filter")); } return(View("Add", new EditFilterViewModel())); }
public Guid?SaveTemplateId(int templateId, bool forceCreateContentGroup) { Guid?result; Log.Add($"save template#{templateId}, CG-exists:{BlockConfiguration.Exists} forceCreateCG:{forceCreateContentGroup}"); // if it exists or has a force-create, then write to the Content-Group, otherwise it's just a preview if (BlockConfiguration.Exists || forceCreateContentGroup) { var existedBeforeSettingTemplate = BlockConfiguration.Exists; //var app = Block.App; var cms = _cmsManager = _cmsManagerLazy.Value.Init(Block?.App, Log); var contentGroupGuid = cms.Blocks.UpdateOrCreateContentGroup(BlockConfiguration, templateId); if (!existedBeforeSettingTemplate) { EnsureLinkToContentGroup(contentGroupGuid); } result = contentGroupGuid; } else { // only set preview / content-group-reference - but must use the guid var dataSource = Block.App.Data; var templateGuid = dataSource.Immutable.One(templateId).EntityGuid; SavePreviewTemplateId(templateGuid); result = null; // send null back } return(result); }
public IActionResult SavePost(RepositoryViewModel model) { if (ModelState.IsValid) { ICmsManager manager = CmsManager.Load(); if (model.IsItANewRepository()) { var newRrepository = model.MapToModel(new Repository()); manager.AddRepository(newRrepository); } else { try { int repoindex = manager.GetIndexById(model.Id.Value); model.MapToModel(manager.Repositories[repoindex]); } catch (InvalidOperationException) { throw new Exception("The content definition not found"); } } manager.Save(); return(Redirect("/fcmsmanager/repository")); } return(View("Edit", new RepositoryViewModel())); }
public IActionResult saveDefinition(ContentDefinitionViewModel model) { if (ModelState.IsValid) { ICmsManager manager = CmsManager.Load(); int repoindex = manager.GetIndexById(model.RepositoryId.Value); if (repoindex < 0) { throw new Exception("The content definition not found"); } IRepository repository = manager.Repositories[repoindex]; if (model.DefinitionId == null) { repository.ContentDefinitions.Add(model.MapToModel(null, this.Request)); } else { model.MapToModel(repository.ContentDefinitions.Where(m => m.DefinitionId == model.DefinitionId).FirstOrDefault(), this.Request); } manager.Save(); return(Redirect("/fcmsmanager/definition?repositoryid=" + model.RepositoryId)); } return(View("Edit", new ContentDefinitionViewModel())); }
public ContentBlockBackend Init(IInstanceContext context, IBlock block, ILog parentLog) { Log.LinkTo(parentLog); _block = block; _context = context; _cmsManager = new CmsManager(_block.App, Log); return(this); }
public IActionResult delete(Guid repositoryid) { var cmsManager = CmsManager.Load(); cmsManager.DeleteRepository(repositoryid); cmsManager.Save(); return(Redirect("/fcmsmanager/repository")); }
public ContentEngine(string repositoryName) { manager = (ICmsManager)Tools.Cacher.Get(MANAGER_CACHE_KEY); if (manager == null) { manager = CmsManager.Load(); Tools.Cacher.Set(MANAGER_CACHE_KEY, manager, manager.Filename); } this.RepositoryName = repositoryName; }
public IActionResult deletedefinition(Guid repositoryid, Guid id) { var cmsManager = CmsManager.Load(); var repository = cmsManager.GetRepositoryById(repositoryid); repository.DeleteDefinition(id); cmsManager.Save(); return(Redirect("/fcmsmanager/definition?repositoryid=" + repositoryid)); }
public FilterViewModel Get(string id) { var maanger = new CmsManager(config["DataLocation"]); Guid guid; if (Guid.TryParse(id, out guid)) { return(maanger.Data.Filters.Where(n => n.Id == guid).Select(m => new FilterViewModel(m)).FirstOrDefault()); } return(null); }
private bool PostSaveUpdateIdsInParent( int appId, Dictionary <Guid, int> postSaveIds, IEnumerable <IGrouping <string, BundleWithHeader <IEntity> > > pairsOrSingleItems) { var wrapLog = Log.Call <bool>($"{appId}"); var app = Factory.Resolve <Apps.App>().Init(new AppIdentity(Eav.Apps.App.AutoLookupZone, appId), ConfigurationProvider.Build(Block, true), false, Log); foreach (var bundle in pairsOrSingleItems) { Log.Add("processing:" + bundle.Key); var entity = app.Data.List.One(bundle.First().Header.ListParent()); var targetIsContentBlock = entity.Type.Name == BlocksRuntime.BlockTypeName; var primaryItem = targetIsContentBlock ? FindContentItem(bundle) : bundle.First(); var primaryId = GetIdFromGuidOrError(postSaveIds, primaryItem.Entity.EntityGuid); var ids = targetIsContentBlock ? new[] { primaryId, FindPresentationItem(postSaveIds, bundle) } : new[] { primaryId as int? }; var index = primaryItem.Header.ListIndex(); // add or update slots //var itemIsReallyNew = primaryItem.EntityId == 0; // only really add if it's really new var willAdd = primaryItem.Header.ListAdd();// && itemIsReallyNew; // 2019-07-01 2dm needed to add this, because new-save already gives it an ID //if (primaryItem.Header.ReallyAddBecauseAlreadyVerified != null) // willAdd = primaryItem.Header.ReallyAddBecauseAlreadyVerified.Value; Log.Add($"will add: {willAdd}; " + // add-pre-verified:{primaryItem.Header.ReallyAddBecauseAlreadyVerified}; " + $"Group.Add:{primaryItem.Header.Add}; EntityId:{primaryItem.Entity.EntityId}"); var cms = new CmsManager(app, Log); var fieldPair = targetIsContentBlock ? ViewParts.PickPair(primaryItem.Header.Group.Part) : new[] { primaryItem.Header.Field }; if (willAdd) // this cannot be auto-detected, it must be specified { cms.Entities.FieldListAdd(entity, fieldPair, index, ids, cms.EnablePublishing); } else { cms.Entities.FieldListReplaceIfModified(entity, fieldPair, index, ids, cms.EnablePublishing); } } // update-module-title BlockEditorBase.GetEditor(Block).UpdateTitle(); return(wrapLog("ok", true)); }
public bool Delete(int appId, int id) { // todo: extra security to only allow zone change if host user Log.Add($"delete a{appId}, t:{id}"); var app = ImpExpHelpers.GetAppAndCheckZoneSwitchPermissions(_tenant.ZoneId, appId, _user, _tenant.ZoneId, Log); var cms = new CmsManager(app, Log); cms.Views.DeleteTemplate(id); return(true); }
public IActionResult Definition(Guid repositoryid) { var cmsManager = CmsManager.Load(); IRepository repository = cmsManager.GetRepositoryById(repositoryid); if (repository == null) { return(Redirect("/fcmsmanager/repository")); } return(View("Index", repository)); }
public bool Delete(int appId, int id) { // todo: extra security to only allow zone change if host user Log.Add($"delete a{appId}, t:{id}"); var app = Dnn.Factory.App(appId, false); var cms = new CmsManager(app, Log); cms.Views.DeleteTemplate(id); return(true); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { ICmsManager cmsmanager = new CmsManager(); IRepository repository = cmsmanager.GetRepositoryByName(this.Name); if (repository != null && repository.Id != this.Id) { yield return(new ValidationResult($"The repository {this.Name} already exists", new String[] { "Name" })); } yield break; }
public IEnumerable <PageViewModel> Index() { var maanger = new CmsManager(config["DataLocation"]); foreach (IRepository repository in maanger.Data.Repositories.Where(m => m.ContentType == ContentType.Page)) { yield return(new PageViewModel() { Id = repository.Id, Name = repository.Name }); } }
public IActionResult delete(Guid repositoryid) { var cmsManager = new CmsManager(); var repo = cmsManager.GetRepositoryById(repositoryid); if (repo != null) { cmsManager.DeleteRepository(repositoryid); cmsManager.Save(); } return(Redirect("/fcmsmanager/" + ViewModelHelpers.GetRepositoryBaseUrl(repo))); }
private void LoadContentStore(IRepository repo) { if (HttpContext.RequestCache.ContainsKey(REPO_CACHE_STORE + repo.Id)) { contentStore = HttpContext.RequestCache[REPO_CACHE_STORE + repo.Id] as IContentStore; } else { contentStore = manager.GetContentStore(repo.Id); HttpContext.RequestCache[REPO_CACHE_STORE + repo.Id] = contentStore; Tools.Cacher.Set(MANAGER_CACHE_KEY, manager, CmsManager.GetContentStoreFilename(repo.Id)); } }
public void CreateFiltersTest() { // create Filter Guid filter1 = Guid.NewGuid(); Guid filter2 = Guid.NewGuid(); Guid filter3 = Guid.NewGuid(); Guid filter4 = Guid.NewGuid(); ICmsManager manager = CmsManager.Load(); manager.Filters.Add(new BooleanFilter() { Id = filter1, Name = "Boolean Filter" }); manager.Filters.Add(new DateRangeFilter() { Id = filter2, Name = "DateRange Filter" }); manager.Filters.Add(new RegExFilter() { Id = filter3, Name = "Regex Filter" }); manager.Filters.Add(new TextFilter() { Id = filter4, Name = "Text Filter" }); manager.Save(); // load and make sure it is there ICmsManager loadedmanager = CmsManager.Load(); Assert.AreEqual(4, loadedmanager.Filters.Count); Assert.AreEqual(filter1, loadedmanager.Filters[0].Id); Assert.AreEqual("Boolean Filter", loadedmanager.Filters[0].Name); Assert.IsTrue(loadedmanager.Filters[0] is BooleanFilter); Assert.AreEqual(filter2, loadedmanager.Filters[1].Id); Assert.AreEqual("DateRange Filter", loadedmanager.Filters[1].Name); Assert.IsTrue(loadedmanager.Filters[1] is DateRangeFilter); Assert.AreEqual(filter3, loadedmanager.Filters[2].Id); Assert.AreEqual("Regex Filter", loadedmanager.Filters[2].Name); Assert.IsTrue(loadedmanager.Filters[2] is RegExFilter); Assert.AreEqual(filter4, loadedmanager.Filters[3].Id); Assert.AreEqual("Text Filter", loadedmanager.Filters[3].Name); Assert.IsTrue(loadedmanager.Filters[3] is TextFilter); }
public IActionResult IndexAction(Guid repositoryid) { IRepository repository = new CmsManager().GetRepositoryById(repositoryid); IContentStore contentStore = new CmsManager().GetContentStore(repositoryid); PageEditorViewModel model = new PageEditorViewModel() { RepositoryId = repositoryid, RepositoryName = repository.Name, ContentDefinitions = repository.ContentDefinitions, ContentItems = contentStore.Items.Where(m => m.Filters.Count == 0).ToList() }; return(View("edit", model)); }
public IActionResult Index(Guid repositoryid) { IRepository repository = new CmsManager().GetRepositoryById(repositoryid); if (repository == null) { return(Redirect("/fcmsmanager/page")); } PageContentViewModel model = new PageContentViewModel(); model.RepositoryId = repositoryid; model.RepositoryName = repository.Name; model.ContentDefinitions = repository.ContentDefinitions; return(View("Index", model)); }
protected void Page_Load(object sender, EventArgs e) { string path = "~/"; string sid = this.Request.QueryString["select"]; if (sid != null) { CmsManager man = new CmsManager(); ICmsPage page = man.GetPage(new Guid(sid)) as ICmsPage; if (page != null) path = page.DefaultUrl.Url; } else { path = UrlHelper.DefaultDocumentUrl; } this.iframe1.Attributes.Add("src", this.ResolveUrl(UrlHelper.ResolveUrl(path))); }
public IActionResult Filter(Guid filterid, int index) { var manager = new CmsManager(); FilterValueViewModel model = new FilterValueViewModel(); model.FilterDefinition = manager.Data.Filters.Where(m => m.Id == filterid).FirstOrDefault(); model.ContentFilter = new ContentFilter(); model.Index = index; if (model.FilterDefinition == null) { return(new ContentResult()); } return(View("NewFilter", model)); }
public void InitTest() { Tools.DeleteCmsFile(); manager = CmsManager.Load(); Repository repository = new Repository() { Id = repositoryId, Name = repositoryName }; IContentDefinition definition = ContentDefinitionFactory.CreateContentDefinition(IContentDefinition.DefinitionType.String); definition.DefinitionId = definitionId; definition.Name = contentName; repository.ContentDefinitions.Add(definition); manager.Repositories.Add(repository); manager.Save(); }
public void Replace(Guid guid, string part, int index, int entityId, bool add = false) { var wrapLog = Log.Call($"target:{guid}, part:{part}, index:{index}, id:{entityId}"); var versioning = BlockBuilder.Environment.PagePublishing; void InternalSave(VersioningActionInfo args) { var cms = new CmsManager(BlockBuilder.App, Log); var entity = cms.AppState.List.One(guid); if (entity == null) { throw new Exception($"Can't find item '{guid}'"); } // correct casing of content / listcontent for now - TODO should already happen in JS-Call if (entity.Type.Name == BlocksRuntime.BlockTypeName) { if (string.Equals(part, ViewParts.Content, OrdinalIgnoreCase)) { part = ViewParts.Content; } if (string.Equals(part, ViewParts.ListContent, OrdinalIgnoreCase)) { part = ViewParts.ListContent; } } if (add) { cms.Entities.FieldListAdd(entity, new[] { part }, index, new int?[] { entityId }, cms.EnablePublishing); } else { cms.Entities.FieldListReplaceIfModified(entity, new[] { part }, index, new int?[] { entityId }, cms.EnablePublishing); } } // use dnn versioning - this is always part of page var context = DnnDynamicCode.Create(BlockBuilder, Log); versioning.DoInsidePublishing(context.Dnn.Module.ModuleID, context.Dnn.User.UserID, InternalSave); wrapLog(null); }
public void AddRepositoryTest() { // create repository Guid repositoryId1 = Guid.NewGuid(); ICmsManager manager = CmsManager.Load(); manager.Repositories.Add( new Repository() { Id = repositoryId1, Name = "Test 1" } ); manager.Save(); // load manager and make sure the first repo is there ICmsManager loadedmanager = CmsManager.Load(); Assert.AreEqual(1, loadedmanager.Repositories.Count); Assert.AreEqual(repositoryId1, loadedmanager.Repositories[0].Id); Assert.AreEqual("Test 1", loadedmanager.Repositories[0].Name); // add one more repo Guid repositoryId2 = Guid.NewGuid(); loadedmanager.Repositories.Add( new Repository() { Id = repositoryId2, Name = "Test 2" } ); loadedmanager.Save(); // load manager and make sure the first repo is there loadedmanager = CmsManager.Load(); Assert.AreEqual(2, loadedmanager.Repositories.Count); Assert.AreEqual(repositoryId1, loadedmanager.Repositories[0].Id); Assert.AreEqual("Test 1", loadedmanager.Repositories[0].Name); Assert.AreEqual(repositoryId2, loadedmanager.Repositories[1].Id); Assert.AreEqual("Test 2", loadedmanager.Repositories[1].Name); manager.Save(); }
// TODO: shouldn't be part of ContentGroupController any more, as it's generic now public void Replace(IInstanceContext context, Guid guid, string part, int index, int entityId, bool add = false) { var wrapLog = Log.Call($"target:{guid}, part:{part}, index:{index}, id:{entityId}"); var versioning = Factory.Resolve <IPagePublishing>().Init(Log); void InternalSave(VersioningActionInfo args) { var cms = new CmsManager(_app, Log); var entity = cms.AppState.List.One(guid); if (entity == null) { throw new Exception($"Can't find item '{guid}'"); } // correct casing of content / listcontent for now - TODO should already happen in JS-Call if (entity.Type.Name == BlocksRuntime.BlockTypeName) { if (string.Equals(part, ViewParts.Content, OrdinalIgnoreCase)) { part = ViewParts.Content; } if (string.Equals(part, ViewParts.ListContent, OrdinalIgnoreCase)) { part = ViewParts.ListContent; } } if (add) { cms.Entities.FieldListAdd(entity, new[] { part }, index, new int?[] { entityId }, cms.EnablePublishing); } else { cms.Entities.FieldListReplaceIfModified(entity, new[] { part }, index, new int?[] { entityId }, cms.EnablePublishing); } } // use dnn versioning - this is always part of page //var block = GetBlock(); versioning.DoInsidePublishing(context, InternalSave); wrapLog(null); }
//void tutLink_Command(object sender, CommandEventArgs e) //{ // if ((HttpContext.Current.Session != null) && (HttpContext.Current.Session.Mode != System.Web.SessionState.SessionStateMode.Off)) // { // this.Page.Session["showTutorial"] = true; // } //} void hintsPanel_DataBound(object sender, EventArgs e) { CmsManager manager = new CmsManager(); HtmlGenericControl pagesLi = GetLi("pagesLi", this.hintsPanel); HtmlAnchor pagesLink = GetLink("pagesLink", this.hintsPanel); HtmlGenericControl modulesLi = GetLi("modulesLi", this.hintsPanel); HtmlAnchor modulesLink = GetLink("modulesLink", this.hintsPanel); HtmlGenericControl filesLi = GetLi("filesLi", this.hintsPanel); HtmlAnchor filesLink = GetLink("filesLink", this.hintsPanel); HtmlGenericControl administrationLi = GetLi("administrationLi", this.hintsPanel); HtmlAnchor administrationLink = GetLink("administrationLink", this.hintsPanel); bool hasPerm = false; foreach (ICmsPage page in manager.GetPages()) { Telerik.Cms.Security.PagePermission testPerm = new Telerik.Cms.Security.PagePermission(page); if (testPerm.CheckDemand(PageRights.View)) { hasPerm = true; break; } } Telerik.Cms.Security.GlobalPermission perm = new Telerik.Cms.Security.GlobalPermission(GlobalRights.ManageUsers); bool canEditTemplates = perm.CheckDemand(GlobalRights.EditTemplates); PagePermission pagePerm = new PagePermission(manager.GetRootPage(), PageRights.View); bool canViewPages = pagePerm.CheckDemand(); if (!canViewPages) { int totalRows; if (manager.GetPages(0, 1, "", System.ComponentModel.ListSortDirection.Ascending, out totalRows, true).Count > 0) canViewPages = true; } if (canViewPages) pagesLink.HRef = "~/Sitefinity/Admin/Pages.aspx"; else if (canEditTemplates) pagesLink.HRef = "~/Sitefinity/Admin/Templates.aspx"; else if (pagesLi != null && pagesLink != null) { pagesLi.Attributes["class"] += " dis"; pagesLink.Attributes["href"] = "#"; } bool canManageServices = false; foreach (IWebModule module in Telerik.Framework.ServiceHost.GetServiceModules()) { if (Util.CheckMinimalServicePermissions(new ServicesPermissions(module.GetType()))) { canManageServices = true; break; } } perm = new Telerik.Cms.Security.GlobalPermission(Telerik.Cms.Security.GlobalRights.ManageUsers | GlobalRights.ManagePermissions); if (administrationLi != null && administrationLink != null && (!perm.CheckDemand() && !canManageServices)) { administrationLi.Attributes["class"] += " dis"; administrationLink.Attributes["href"] = "#"; } perm = new Telerik.Cms.Security.GlobalPermission(Telerik.Cms.Security.GlobalRights.ManageFiles); if (filesLi != null && filesLink != null && !perm.CheckDemand()) { filesLi.Attributes["class"] += " dis"; filesLink.Attributes["href"] = "#"; } bool showModules = false; List<IWebModule> webModules = new List<IWebModule>(); foreach (IWebModule module in ModuleManager.GetWebModulesValues()) { if (module is IModule) showModules = Util.CheckMinimalPermissions(module as IModule); if (showModules) break; } if (modulesLi != null && modulesLink != null && !showModules) { modulesLi.Attributes["class"] += " dis"; modulesLink.Attributes["href"] = "#"; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bool showMainSection = PersonalizationManager.DefaultInstance.GetGlobalValue(GlobalSettingConstants.ShowMainSection, true); if (showMainSection) { hintsPanel.DataBind(); //Now we have inject the hide script for the bottom hide link HyperLink lnkHideMain = (HyperLink)hintsPanel.FindControl("lnkHideMain"); string script = string.Format("javascript:Personalization.hideDashboardMainSection('{0}')", pnlMainSection.ClientID); lnkHideMain.Attributes.Add("onclick", script); pnlMainSection.Visible = true; } else { pnlMainSection.Visible = false; } InTrayInfo inTrayInfo; // Dashboard box 1 - Pages CmsManager manager = new CmsManager(); Telerik.Cms.Security.PagePermission viewPerm = new Telerik.Cms.Security.PagePermission(manager.GetRootPage(), Telerik.Cms.Security.PageRights.View); if (viewPerm.CheckDemand()) { IList pages = manager.GetPages(); inTrayInfo = new PagesInTrayInfo((string)this.GetLocalResourceObject("Pages"), (string)this.GetLocalResourceObject("RecentlyModified")); inTrayInfo.SortBy = "DateModified"; inTrayInfo.SortDirection = System.ComponentModel.ListSortDirection.Descending; dbbPages.DataSource = inTrayInfo.GetAsDataSource(); dbbPages.DataBind(); } else { dbbPages.Visible = false; } // Dashboard box 2 - Modules inTrayInfo = new InTrayInfo(new ArrayList(), (string)this.GetLocalResourceObject("ModuleItems"), (string)this.GetLocalResourceObject("RecentlyModified")); inTrayInfo.SortBy = "DateModified"; inTrayInfo.SortDirection = System.ComponentModel.ListSortDirection.Descending; dbbModules.DataSource = inTrayInfo.GetAsDataSource(); dbbModules.DataBind(); // Dashboard box 4 - Files inTrayInfo = new InTrayInfo(new ArrayList(), (string)this.GetLocalResourceObject("UploadFiles"), (string)this.GetLocalResourceObject("RecentlyUploaded")); inTrayInfo.SortBy = "UploadDate"; inTrayInfo.SortDirection = System.ComponentModel.ListSortDirection.Descending; dbbFiles.DataSource = inTrayInfo.GetAsDataSource(); dbbFiles.DataBind(); Telerik.Cms.Security.GlobalPermission perm = new Telerik.Cms.Security.GlobalPermission(Telerik.Cms.Security.GlobalRights.ManageUsers); if (perm.CheckDemand()) { // Dashboard box 3 - Users inTrayInfo = new UsersInTrayInfo((string)this.GetLocalResourceObject("Users"), (string)this.GetLocalResourceObject("RecentlyRegistered")); inTrayInfo.SortBy = "CreationDate"; inTrayInfo.SortDirection = System.ComponentModel.ListSortDirection.Descending; dbbUsers.DataSource = inTrayInfo.GetAsDataSource(); dbbUsers.DataBind(); } else { dbbUsers.Visible = false; this.addUserLink.Visible = false; } Telerik.Cms.Security.PagePermission rootPerm = new Telerik.Cms.Security.PagePermission(manager.GetRootPage(), Telerik.Cms.Security.PageRights.Create); if (!rootPerm.CheckDemand()) { this.createPageLink.Visible = false; HyperLink newPageLink = dbbPages.FindControl("linkNewPage") as HyperLink; if (newPageLink != null) newPageLink.Visible = false; } List<IWebModule> webModules = new List<IWebModule>(); foreach (IWebModule module in ModuleManager.GetWebModulesValues()) { if (module is SecuredModule && ((SecuredModule)module).CanCreate()) webModules.Add(module); } if (webModules.Count > 0) { repeaterModules.DataSource = webModules; repeaterModules.DataBind(); } else if (webModules.Count == 0 && !createPageLink.Visible && !addUserLink.Visible) { dashToLiteral.Visible = false; } } }