Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptRegistrar"/> class.
        /// </summary>
        /// <param name="scripts">The scripts.</param>
        /// <param name="scriptableComponents">The scriptable components.</param>
        /// <param name="viewContext">The view context.</param>
        /// <param name="assetItemMerger">The asset merger.</param>
        /// <param name="scriptWrapper">The script wrapper.</param>
        public ScriptRegistrar(WebAssetCollection scripts, IList <IScriptableComponent> scriptableComponents, ViewContext viewContext, IWebAssetCollectionResolver resolver, ScriptWrapperBase scriptWrapper)
        {
            this.resolver = resolver;

            if (viewContext.HttpContext.Items[Key] != null)
            {
                throw new InvalidOperationException(Resources.TextResource.OnlyOneScriptRegistrarIsAllowedInASingleRequest);
            }

            viewContext.HttpContext.Items[Key] = this;

            OutputScriptFiles = true;

            DefaultGroup = new WebAssetGroup("default", false)
            {
                DefaultPath = WebAssetDefaultSettings.ScriptFilesPath
            };
            Scripts = scripts;
            Scripts.Insert(0, DefaultGroup);

            this.scriptableComponents = scriptableComponents;
            ViewContext      = viewContext;
            ScriptWrapper    = scriptWrapper;
            AssetHandlerPath = WebAssetHttpHandler.DefaultPath;

            OnDocumentReadyActions    = new List <Action>();
            OnDocumentReadyStatements = new List <string>();
            OnWindowUnloadActions     = new List <Action>();
            OnWindowUnloadStatements  = new List <string>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptRegistrar"/> class.
        /// </summary>
        /// <param name="scripts">The scripts.</param>
        /// <param name="scriptableComponents">The scriptable components.</param>
        /// <param name="viewContext">The view context.</param>
        /// <param name="assetItemMerger">The asset merger.</param>
        /// <param name="scriptWrapper">The script wrapper.</param>
        public ScriptRegistrar(WebAssetCollection scripts, IList<IScriptableComponent> scriptableComponents, ViewContext viewContext, IWebAssetCollectionResolver resolver, ScriptWrapperBase scriptWrapper)
        {
            this.resolver = resolver;

            if (viewContext.HttpContext.Items[Key] != null)
            {
                throw new InvalidOperationException(Resources.TextResource.OnlyOneScriptRegistrarIsAllowedInASingleRequest);
            }

            viewContext.HttpContext.Items[Key] = this;

            OutputScriptFiles = true;

            DefaultGroup = new WebAssetGroup("default", false) { DefaultPath = WebAssetDefaultSettings.ScriptFilesPath };
            Scripts = scripts;
            Scripts.Insert(0, DefaultGroup);

            this.scriptableComponents = scriptableComponents;
            ViewContext = viewContext;
            ScriptWrapper = scriptWrapper;
            AssetHandlerPath = WebAssetHttpHandler.DefaultPath;

            OnDocumentReadyActions = new List<Action>();
            OnDocumentReadyStatements = new List<string>();
            OnWindowUnloadActions = new List<Action>();
            OnWindowUnloadStatements = new List<string>();
        }
Exemple #3
0
        public Editor(ViewContext viewContext,
                      IClientSideObjectWriterFactory clientSideObjectWriterFactory,
                      IWebAssetCollectionResolver resolver,
                      ILocalizationService localizationService,
                      IUrlGenerator urlGenerator)
            : base(viewContext, clientSideObjectWriterFactory)
        {
            this.resolver     = resolver;
            this.urlGenerator = urlGenerator;

            ScriptFileNames.AddRange(new[] {
                "telerik.common.js",
                "telerik.list.js",
                "telerik.combobox.js",
                "telerik.draganddrop.js",
                "telerik.window.js",
                "telerik.editor.js"
            });

            DefaultToolGroup = new EditorToolGroup(this);

            ClientEvents = new EditorClientEvents();

            StyleSheets = new WebAssetGroup("default", false)
            {
                DefaultPath = WebAssetDefaultSettings.StyleSheetFilesPath
            };

            Localization = new EditorLocalization(localizationService, CultureInfo.CurrentUICulture);

            Template = new HtmlTemplate();

            new EditorToolFactory(DefaultToolGroup)
            .Bold().Italic().Underline().Strikethrough()
            .Separator()
            .FontName()
            .FontSize()
            .FontColor().BackColor()
            .Separator()
            .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
            .Separator()
            .InsertUnorderedList().InsertOrderedList()
            .Separator()
            .Outdent().Indent()
            .Separator()
            .FormatBlock()
            .Separator()
            .CreateLink().Unlink()
            .Separator()
            .InsertImage();

            FileBrowserSettings = new EditorFileBrowserSettings(this);

            DefaultToolGroup.Tools.OfType <EditorComboBox>()
            .Each(combo => combo.InputHtmlAttributes.Add("title", combo.Identifier));
        }
Exemple #4
0
        public Editor(ViewContext viewContext, 
            IClientSideObjectWriterFactory clientSideObjectWriterFactory, 
            IWebAssetCollectionResolver resolver, 
            ILocalizationService localizationService,
            IUrlGenerator urlGenerator)
            : base(viewContext, clientSideObjectWriterFactory)
        {
            this.resolver = resolver;
            this.urlGenerator = urlGenerator;

            ScriptFileNames.AddRange(new[] {
                "telerik.common.js",
                "telerik.list.js",
                "telerik.combobox.js",
                "telerik.draganddrop.js",
                "telerik.window.js",
                "telerik.editor.js"
            });

            DefaultToolGroup = new EditorToolGroup(this);

            ClientEvents = new EditorClientEvents();

            StyleSheets = new WebAssetGroup("default", false) { DefaultPath = WebAssetDefaultSettings.StyleSheetFilesPath };

            Localization = new EditorLocalization(localizationService, CultureInfo.CurrentUICulture);

            Template = new HtmlTemplate();

            new EditorToolFactory(DefaultToolGroup)
                .Bold().Italic().Underline().Strikethrough()
                .Separator()
                .FontName()
                .FontSize()
                .FontColor().BackColor()
                .Separator()
                .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
                .Separator()
                .InsertUnorderedList().InsertOrderedList()
                .Separator()
                .Outdent().Indent()
                .Separator()
                .FormatBlock()
                .Separator()
                .CreateLink().Unlink()
                .Separator()
                .InsertImage();

            FileBrowserSettings = new EditorFileBrowserSettings(this);

            DefaultToolGroup.Tools.OfType<EditorComboBox>()
                .Each(combo => combo.InputHtmlAttributes.Add("title", combo.Identifier));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StyleSheetRegistrar"/> class.
        /// </summary>
        /// <param name="styleSheets">The style sheets.</param>
        /// <param name="viewContext">The view context.</param>
        /// <param name="assetItemMerger">The asset merger.</param>
        public StyleSheetRegistrar(WebAssetCollection styleSheets, ViewContext viewContext, IWebAssetCollectionResolver resolver)
        {
            this.resolver = resolver;

            if (viewContext.HttpContext.Items[Key] != null)
            {
                throw new InvalidOperationException(Resources.TextResource.OnlyOneStyleSheetRegistrarIsAllowedInASingleRequest);
            }

            viewContext.HttpContext.Items[Key] = this;

            DefaultGroup = new WebAssetGroup("default", false) { DefaultPath = WebAssetDefaultSettings.StyleSheetFilesPath };
            StyleSheets = styleSheets;
            styleSheets.Insert(0, DefaultGroup);

            ViewContext = viewContext;

            AssetHandlerPath = WebAssetHttpHandler.DefaultPath;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StyleSheetRegistrar"/> class.
        /// </summary>
        /// <param name="styleSheets">The style sheets.</param>
        /// <param name="viewContext">The view context.</param>
        /// <param name="assetItemMerger">The asset merger.</param>
        public StyleSheetRegistrar(WebAssetCollection styleSheets, ViewContext viewContext, IWebAssetCollectionResolver resolver)
        {
            this.resolver = resolver;

            if (viewContext.HttpContext.Items[Key] != null)
            {
                throw new InvalidOperationException(Resources.TextResource.OnlyOneStyleSheetRegistrarIsAllowedInASingleRequest);
            }

            viewContext.HttpContext.Items[Key] = this;

            DefaultGroup = new WebAssetGroup("default", false)
            {
                DefaultPath = WebAssetDefaultSettings.StyleSheetFilesPath
            };
            StyleSheets = styleSheets;
            styleSheets.Insert(0, DefaultGroup);

            ViewContext = viewContext;

            AssetHandlerPath = WebAssetHttpHandler.DefaultPath;
        }