예제 #1
0
        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);
        }
예제 #2
0
 private DropDownItem Map(DynamicModuleType dynamicModuleType)
 {
     return(new DropDownItem
     {
         Value = dynamicModuleType.GetFullTypeName(),
         Text = String.Format("{0} ({1})", dynamicModuleType.TypeName, dynamicModuleType.ModuleName)
     });
 }
예제 #3
0
        /// <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);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
        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);
        }