private static void RegisterToolboxItem(Telerik.Sitefinity.DynamicModules.Builder.Model.DynamicModule dynamicModule, DynamicModuleType moduleType) { MvcWidgetInstaller.UnregisterToolboxItem(moduleType.GetFullTypeName()); var configurationManager = ConfigManager.GetManager(); var toolboxesConfig = configurationManager.GetSection <ToolboxesConfig>(); var section = MvcWidgetInstaller.GetModuleToolboxSection(dynamicModule, toolboxesConfig); if (section == null) { return; } var toolboxItem = new ToolboxItem(section.Tools) { Name = moduleType.GetFullTypeName() + "_MVC", Title = PluralsResolver.Instance.ToPlural(moduleType.DisplayName), Description = string.Empty, ModuleName = dynamicModule.Name, ControlType = typeof(MvcWidgetProxy).AssemblyQualifiedName, ControllerType = typeof(DynamicContentController).FullName, CssClass = "sfNewsViewIcn sfMvcIcn", Parameters = new NameValueCollection() { { "WidgetName", moduleType.TypeName }, { "ControllerName", typeof(DynamicContentController).FullName } } }; section.Tools.Add(toolboxItem); configurationManager.SaveSection(toolboxesConfig); }
private DropDownItem Map(DynamicModuleType dynamicModuleType) { return(new DropDownItem { Value = dynamicModuleType.GetFullTypeName(), Text = String.Format("{0} ({1})", dynamicModuleType.TypeName, dynamicModuleType.ModuleName) }); }
/// <summary> /// Installs the default detail template. /// </summary> /// <param name="dynamicModule">The dynamic module.</param> /// <param name="moduleType">Type of the module.</param> /// <returns></returns> public Guid InstallDetailTemplate(DynamicModule dynamicModule, DynamicModuleType moduleType) { var moduleTitle = dynamicModule.Title; var area = string.Format(MvcConstants.DynamicAreaFormat, moduleTitle, moduleType.DisplayName); var pluralModuleTypeName = PluralsResolver.Instance.ToPlural(moduleType.DisplayName); var dynamicTypeName = moduleType.GetFullTypeName(); var condition = string.Format(MvcConstants.MvcTemplateCondition, dynamicTypeName); var controlType = typeof(DynamicContentController).FullName; var detailTemplateName = string.Format(MvcConstants.DetailTemplateName, moduleType.DisplayName); var friendlyControlDetail = string.Format(MvcConstants.FriendlyControlDynamicDetailTemplate, moduleTitle, pluralModuleTypeName); var nameForDevelopersDetail = detailTemplateName.Replace('.', '-'); var content = this.GenerateDetailTemplate(moduleType); var detailTemplate = this.RegisteredTemplate(area, detailTemplateName, nameForDevelopersDetail, friendlyControlDetail, content, condition, controlType); return(detailTemplate.Id); }
/// <summary> /// Installs the default detail template. /// </summary> /// <param name="dynamicModule">The dynamic module.</param> /// <param name="moduleType">Type of the module.</param> /// <returns></returns> public Guid InstallDetailTemplate(DynamicModule dynamicModule, DynamicModuleType moduleType) { var moduleTitle = dynamicModule.Title; var area = string.Format(MvcConstants.DynamicAreaFormat, moduleTitle, moduleType.DisplayName); var pluralModuleTypeName = PluralsResolver.Instance.ToPlural(moduleType.DisplayName); var dynamicTypeName = moduleType.GetFullTypeName(); var condition = string.Format(MvcConstants.MvcTemplateCondition, dynamicTypeName); var controlType = typeof(DynamicContentController).FullName; var detailTemplateName = string.Format(MvcConstants.DetailTemplateName, moduleType.DisplayName); var friendlyControlDetail = string.Format(MvcConstants.FriendlyControlDynamicDetailTemplate, moduleTitle, pluralModuleTypeName); var nameForDevelopersDetail = detailTemplateName.Replace('.', '-'); var content = this.GenerateDetailTemplate(moduleType); var detailTemplate = this.RegisteredTemplate(area, detailTemplateName, nameForDevelopersDetail, friendlyControlDetail, content, condition, controlType); Type dynamicType = Telerik.Sitefinity.Utilities.TypeConverters.TypeResolutionService.ResolveType(moduleType.GetFullTypeName(), false); ControlTemplates.RegisterTemplatableControl(typeof(DynamicContentController), dynamicType, null, area, string.Format("{0} - single", area)); return(detailTemplate.Id); }
private static void RegisterToolboxItem(Telerik.Sitefinity.DynamicModules.Builder.Model.DynamicModule dynamicModule, DynamicModuleType moduleType) { MvcWidgetInstaller.UnregisterToolboxItem(moduleType.GetFullTypeName()); var configurationManager = ConfigManager.GetManager(); var toolboxesConfig = configurationManager.GetSection<ToolboxesConfig>(); var section = MvcWidgetInstaller.GetModuleToolboxSection(dynamicModule, toolboxesConfig); if (section == null) return; var toolboxItem = new ToolboxItem(section.Tools) { Name = moduleType.GetFullTypeName() + "_MVC", Title = PluralsResolver.Instance.ToPlural(moduleType.DisplayName), Description = string.Empty, ModuleName = dynamicModule.Name, ControlType = typeof(MvcWidgetProxy).AssemblyQualifiedName, ControllerType = typeof(DynamicContentController).FullName, CssClass = "sfNewsViewIcn sfMvcIcn", Parameters = new NameValueCollection() { { "WidgetName", moduleType.TypeName }, { "ControllerName", typeof(DynamicContentController).FullName } } }; section.Tools.Add(toolboxItem); configurationManager.SaveSection(toolboxesConfig); }