public override bool HasRequiredContext(Control control) { if (PluginManager.IsEnabled(this)) { return(base.HasRequiredContext(control)); } return(false); }
public void Initialize() { ThemeUtility themeUtility = PluginManager.GetSingleton <ThemeUtility>(); IThemeUtilities utilites = PluginManager.GetSingleton <IThemeUtilities>(); if (themeUtility == null || utilites == null || !utilites.EnableFileSystemWatcher) { return; } _siteThemeName = CSContext.Current.SiteTheme; InitialiseFileSystemWatcher(Constants.DefaultWidgets, themeUtility.ResetCache); InitialiseFileSystemWatcher(Constants.FactoryDefaultConfigurations, () => themeUtility.RevertTheme(ReversionType.Configuration), _siteThemeName); InitialiseFileSystemWatcher(Constants.FactoryDefaultPages, () => themeUtility.RevertTheme(ReversionType.Layouts), _siteThemeName); InitialiseFileSystemWatcher(Constants.ThemeFiles, () => themeUtility.RevertTheme(ReversionType.Files), string.Format(@"s\fd\{0}", _siteThemeName)); }
private void EnumeratePluginsAndAction(Func <Type, string, string, string> commandString) { //Add the profile fields to var plugins = PluginManager.Get <IProfilePlugin>(); foreach (IProfilePlugin socialProfilePlugin in plugins) { Type type = socialProfilePlugin.GetType(); using (var connection = new SqlConnection(DefaultConnectionString)) { connection.Open(); using (var command = new SqlCommand(commandString(type, socialProfilePlugin.FieldName, socialProfilePlugin.FieldType), connection)) { command.ExecuteNonQuery(); } } } }
public int[] GetViewSecurityRoles(Guid contentId) { var splist = listService.Get(new SPListGetOptions(contentId)); if (splist != null) { var group = TEApi.Groups.Get(new GroupsGetOptions { Id = splist.GroupId }); if (!group.HasErrors()) { var groupSearchType = PluginManager.Get <ISearchableContentType>().FirstOrDefault(x => x.ContentTypeId == TEApi.Groups.ContentTypeId); if (groupSearchType != null) { return(groupSearchType.GetViewSecurityRoles(group.ContainerId)); } } } return(new int[0]); }
protected void ContextualItem(Action <IApplication> applicationUse, Action <IContainer> containerUse, Action <string[]> tagsUse) { IApplication currentApplication = null; IContainer currentContainer = null; string[] tags = null; foreach (var contextItem in PublicApi.Url.CurrentContext.ContextItems.GetAllContextItems()) { var app = PluginManager.Get <IApplicationType>().FirstOrDefault(a => a.ApplicationTypeId == contextItem.ApplicationTypeId); if (app != null && contextItem.ApplicationId.HasValue) { IApplication application = app.Get(contextItem.ApplicationId.Value); if (application != null) { if (application.Container.ContainerId != application.ApplicationId) { currentApplication = application; } } } var container = PluginManager.Get <IContainerType>().FirstOrDefault(a => a.ContainerTypeId == contextItem.ContainerTypeId); if (container != null && contextItem.ContainerId.HasValue && contextItem.ContainerTypeId == PublicApi.Groups.ContainerTypeId) { currentContainer = container.Get(contextItem.ContainerId.Value); } if (contextItem.TypeName == "Tags") { tags = contextItem.Id.Split(new[] { '/' }); } } switch (ContextualMode) { case ContextMode.GroupContext: if (currentContainer != null) { containerUse(currentContainer); } break; case ContextMode.Context: { if (currentApplication != null) { applicationUse(currentApplication); } else if (currentContainer != null) { containerUse(currentContainer); } if (tags != null) { tagsUse(tags); } } break; } }