示例#1
0
        /// <summary>
        /// Gets the editor.
        /// </summary>
        /// <param name="placeHolderHtmlEditor">
        /// The place holder HTML editor.
        /// </param>
        /// <param name="moduleId">
        /// The module ID.
        /// </param>
        /// <param name="showUpload">
        /// The show Upload.
        /// </param>
        /// <param name="PortalSettings">
        /// The portal Settings.
        /// </param>
        /// <returns>
        /// The HTML editor interface.
        /// </returns>
        public IHtmlEditor GetEditor(
            Control placeHolderHtmlEditor, int moduleId, bool showUpload, PortalSettings PortalSettings)
        {
            IHtmlEditor desktopText;
            var         moduleImageFolder = ModuleSettings.GetModuleSettings(moduleId)["MODULE_IMAGE_FOLDER"].ToString();

            // Grabs ID from the place holder so that a unique editor is on the page if more than one
            // But keeps same ID so that the information can be submitted to be saved. [CDT]
            var uniqueId = placeHolderHtmlEditor.ID;

            switch (this.Value)
            {
            case "CKeditor":     // 09/03/2016
                var CKfckv2 = new CKEditorTextbox
                {
                    ImageFolder   = moduleImageFolder,
                    ResizeEnabled = false,
                    Language      = PortalSettings.PortalUILanguage.TwoLetterISOLanguageName
                };

                CKfckv2.BasePath = Path.WebPathCombine(
                    Path.ApplicationRoot, "/aspnet_client/CKEditorV4.6.2");

                desktopText = CKfckv2;
                break;

            case "Codewriter":
                desktopText = new CodeWriterTextbox();
                break;

            // case "Code Mirror Plain Text":
            default:
                var codeMirrorTextBox = new CodeMirrorTextBox();
                desktopText = codeMirrorTextBox;
                break;
            }

            placeHolderHtmlEditor.Controls.Add((Control)desktopText);
            return(desktopText);
        }
        /// <summary>
        /// Gets the editor.
        /// </summary>
        /// <param name="placeHolderHtmlEditor">
        /// The place holder HTML editor.
        /// </param>
        /// <param name="moduleId">
        /// The module ID.
        /// </param>
        /// <param name="showUpload">
        /// The show Upload.
        /// </param>
        /// <param name="PortalSettings">
        /// The portal Settings.
        /// </param>
        /// <returns>
        /// The HTML editor interface.
        /// </returns>
        public IHtmlEditor GetEditor(
            Control placeHolderHtmlEditor, int moduleId, bool showUpload, PortalSettings PortalSettings)
        {
            IHtmlEditor desktopText;
            var         moduleImageFolder = ModuleSettings.GetModuleSettings(moduleId)["MODULE_IMAGE_FOLDER"].ToString();

            // Grabs ID from the place holder so that a unique editor is on the page if more than one
            // But keeps same ID so that the information can be submitted to be saved. [CDT]
            var uniqueId = placeHolderHtmlEditor.ID;

            switch (this.Value)
            {
            case "TinyMCE Editor":
                var tinyMce = new TinyMCETextBox {
                    ImageFolder = moduleImageFolder
                };
                desktopText = tinyMce;
                break;

            case "FCKeditor":     // 9/8/2010
                var conector = Path.ApplicationRootPath("/app_support/FCKconnectorV2.aspx");
                var fckv2    = new FCKTextBoxV2
                {
                    ImageFolder        = moduleImageFolder,
                    BasePath           = Path.WebPathCombine(Path.ApplicationRoot, "aspnet_client/FCKeditorV2.6.6/"),
                    AutoDetectLanguage = false,
                    DefaultLanguage    = PortalSettings.PortalUILanguage.Name.Substring(0, 2),
                    ID = string.Concat("FCKTextBox", uniqueId),
                    ImageBrowserURL =
                        Path.WebPathCombine(
                            Path.ApplicationRoot,
                            string.Format(
                                "aspnet_client/FCKeditorV2.6.6/editor/filemanager/browser/default/browser.html?Type=Image%26Connector={0}",
                                conector)),
                    LinkBrowserURL =
                        Path.WebPathCombine(
                            Path.ApplicationRoot,
                            string.Format(
                                "aspnet_client/FCKeditorV2.6.6/editor/filemanager/browser/default/browser.html?Connector={0}",
                                conector))
                };

                // fckv2.EditorAreaCSS = PortalSettings.GetCurrentTheme().CssFile;
                desktopText = fckv2;
                break;

            case "Syrinx CkEditor":
                CkEditor.CkEditorJS = Path.WebPathCombine(
                    Path.ApplicationRoot, "aspnet_client/ckeditor/ckeditor.js");

                var sckvtb = new SyrinxCkTextBox
                {
                    ImageFolder    = moduleImageFolder,
                    BaseContentUrl = Path.WebPathCombine(Path.ApplicationRoot, "aspnet_client/ckeditor/"),
                    Resizable      = false,
                    Language       = PortalSettings.PortalUILanguage.TwoLetterISOLanguageName
                };

                desktopText = sckvtb;
                break;

            case "FreeTextBox":
                var freeText = new FreeTextBox
                {
                    ImageGalleryUrl =
                        Path.WebPathCombine(
                            Path.ApplicationFullPath,
                            "app_support/ftb.imagegallery.aspx?rif={0}&cif={0}&mID=" + moduleId),
                    ImageFolder      = moduleImageFolder,
                    ImageGalleryPath = Path.WebPathCombine(PortalSettings.PortalFullPath, moduleImageFolder),
                    ID                    = string.Concat("FreeText", uniqueId),
                    Language              = GetFtbLanguage(PortalSettings.PortalUILanguage.Name),
                    JavaScriptLocation    = ResourceLocation.ExternalFile,
                    ButtonImagesLocation  = ResourceLocation.ExternalFile,
                    ToolbarImagesLocation = ResourceLocation.ExternalFile,
                    SupportFolder         = Path.WebPathCombine(Path.ApplicationFullPath, "aspnet_client/FreeTextBox")
                };

                // freeText.ToolbarLayout =
                // "ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorPicker,FontBackColorPicker,FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat;CreateLink,Unlink|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;InsertRule|Delete,Cut,Copy,Paste;Undo,Redo,Print;InsertTable,InsertTableColumnAfter,InsertTableColumnBefore,InsertTableRowAfter,InsertTableRowBefore,DeleteTableColumn,DeleteTableRow,InsertImageFromGallery";
                desktopText = freeText;
                break;

            // case "Code Mirror Plain Text":
            default:
                var codeMirrorTextBox = new CodeMirrorTextBox();
                desktopText = codeMirrorTextBox;
                break;
            }

            placeHolderHtmlEditor.Controls.Add((Control)desktopText);
            return(desktopText);
        }