Ejemplo n.º 1
0
 private static void UnregisterTemplatableControl()
 {
     ControlTemplates.UnregisterTemplatableControl(new ControlTemplateInfo()
     {
         ControlType = typeof(FormController), AreaName = "Form"
     });
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemTemplates"/> class.
        /// </summary>
        public ItemTemplates()
        {
            TypeTemplates.Add(typeof(DateTime), TemplateConfig.Instance.DateTimeTemplate);

            ControlTemplates.Add(Control.General, TemplateConfig.Instance.GeneralTemplate);
            ControlTemplates.Add(Control.CheckBox, TemplateConfig.Instance.CheckBoxTemplate);
            ControlTemplates.Add(Control.RadioButton, TemplateConfig.Instance.RadioButtonTemplate);

            DefaultHtmlAttributes = new { @class = TemplateConfig.Instance.DefaultHtmlAttributes };
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Registers MVC widgets as templatable controls
        /// </summary>
        /// <param name="controllerTypes">The controller types.</param>
        private void RegisterTemplateableControls(IEnumerable <Type> controllerTypes)
        {
            controllerTypes = controllerTypes.Where(x => this.IsTemplatableControl(x));

            foreach (Type controllerType in controllerTypes)
            {
                var widgetName    = controllerType.Name.Replace("Controller", string.Empty);
                var mvcWidgetName = string.Format(CultureInfo.InvariantCulture, "{0} (MVC)", widgetName);

                ControlTemplates.RegisterTemplatableControl(controllerType, controllerType, string.Empty, widgetName, mvcWidgetName);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes the service with specified settings.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            Config.RegisterSection <RealEstateConfig>();
            Res.RegisterResource <RealEstateResources>();
            ObjectFactory.RegisterWebService(typeof(RealEstateBackendService), "Sitefinity/Services/Content/RealEstate.svc");

            //register templatable controls
            ControlTemplates.RegisterTemplatableControl(typeof(MasterListView), typeof(RealEstateItem));
            ControlTemplates.RegisterTemplatableControl(typeof(DetailsView), typeof(RealEstateItem));
        }
        /// <summary>
        /// Initializes the service with specified settings.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public override void Initialize(ModuleSettings settings)
        {
            base.Initialize(settings);

            Config.RegisterSection <AgentsConfig>();
            Res.RegisterResource <AgentsResources>();
            SystemManager.RegisterWebService(typeof(AgentsBackendService), "Sitefinity/Services/Content/Agents.svc");
            SystemManager.RegisterWebService(typeof(MailerBackendService), "Sitefinity/Services/Content/Mailer.svc");

            //register templatable controls
            ControlTemplates.RegisterTemplatableControl(typeof(MasterListView), typeof(AgentItem));
            ControlTemplates.RegisterTemplatableControl(typeof(DetailsView), typeof(AgentItem));
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 private string ControlTemplateFor(Control control)
 {
     return(ControlTemplates.ContainsKey(control) ? ControlTemplates[control] : string.Empty);
 }