Ejemplo n.º 1
0
        public override void InitializeControl(object context)
        {
            _ftbCtl = new FreeTextBox {
                ID = ControlId
            };

            if (Width != Unit.Empty)
            {
                _ftbCtl.Width = Width;
            }

            if (Height != Unit.Empty)
            {
                _ftbCtl.Height = Height;
            }

            if (_toolbarlayout != null && _toolbarlayout.Trim().Length != 0)
            {
                _ftbCtl.ToolbarLayout = _toolbarlayout;
            }
            _ftbCtl.FormatHtmlTagsToXhtml    = _formatHtmlTagsToXhtml;
            _ftbCtl.RemoveServerNameFromUrls = _removeServerNamefromUrls;

            if (!string.IsNullOrEmpty(_webFormFolder))
            {
                _ftbCtl.ImageGalleryUrl =
                    HttpHelper.ExpandTildePath(_webFormFolder + "ftb.imagegallery.aspx?rif={0}&cif={0}");
            }
            var    subtextContext    = context as ISubtextContext;
            string blogImageRootPath = subtextContext.UrlHelper.ImageDirectoryUrl(subtextContext.Blog);

            _ftbCtl.ImageGalleryPath = blogImageRootPath;
        }
Ejemplo n.º 2
0
 public FreeTextBoxAdapter()
 {
     freeTextBox = new FreeTextBox();
     freeTextBox.ID = "freeTextBox";
     freeTextBox.DesignModeCss = "ftb/designmode.css";
     freeTextBox.SupportFolder = "ftb/";
     freeTextBox.ToolbarLayout = "ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;IeSpellCheck,CreateLink,Unlink,InsertImage,InsertImageFromGallery,InsertRule|Cut,Copy,Paste;Undo,Redo,Print";
     freeTextBox.ImageGalleryUrl = "ftb/ftb.imagegallery.aspx?rif={0}&cif={0}";
     freeTextBox.RemoveServerNameFromUrls = false;
     freeTextBox.TextDirection = FreeTextBoxControls.TextDirection.LeftToRight;
     freeTextBox.ImageGalleryPath = SiteConfig.GetSiteConfig().BinariesDir;
 }
Ejemplo n.º 3
0
        protected override void CreatePresentationChildControls()
        {
            literal = new Literal();
            literal.ID = this.ID + "Literal1";
            this.Controls.Add(literal);

            textBox = new FreeTextBox();
            textBox.ID = this.ID + "TextBox1";
            this.Controls.Add(textBox);
            textBox.Visible = false;

            ChildControlsCreated = true;
        }
Ejemplo n.º 4
0
        protected override void CreateAuthoringChildControls()
        {
            literal = new Literal();
            literal.ID = this.ID + "Literal1";
            this.Controls.Add(literal);
            literal.Visible = false;

            textBox = new FreeTextBox();
            textBox.ID = this.ID + "TextBox1";
            this.Controls.Add(textBox);

            textBox.Width = Width;
            textBox.Height = Height;
            textBox.Visible = true;

            //image galleries
            if(((CmsWebDirectory)CmsPage.Current.ParentDirectory).HasImageGallery){
                textBox.Toolbars[2].Items.Add( new InsertImageFromGallery());
                textBox.ImageGalleryUrl = ResolveUrl( CmsConfiguration.Current.AdminPath + "MediaGalleries/ftb.imagegallery.aspx?GalleryID=" + ((CmsWebDirectory)CmsPage.Current.ParentDirectory).ImageGalleryID );
            }

            ChildControlsCreated = true;
        }
        public override void InitializeControl(object context)
        {
            _ftbCtl = new FreeTextBox {ID = ControlId};

            if(Width != Unit.Empty)
            {
                _ftbCtl.Width = Width;
            }

            if(Height != Unit.Empty)
            {
                _ftbCtl.Height = Height;
            }

            if(_toolbarlayout != null && _toolbarlayout.Trim().Length != 0)
            {
                _ftbCtl.ToolbarLayout = _toolbarlayout;
            }
            _ftbCtl.FormatHtmlTagsToXhtml = _formatHtmlTagsToXhtml;
            _ftbCtl.RemoveServerNameFromUrls = _removeServerNamefromUrls;

            if(!string.IsNullOrEmpty(_webFormFolder))
            {
                _ftbCtl.ImageGalleryUrl =
                    HttpHelper.ExpandTildePath(_webFormFolder + "ftb.imagegallery.aspx?rif={0}&cif={0}");
            }
            var subtextContext = context as ISubtextContext;
            string blogImageRootPath = subtextContext.UrlHelper.ImageDirectoryUrl(subtextContext.Blog);
            _ftbCtl.ImageGalleryPath = blogImageRootPath;
        }
Ejemplo n.º 6
0
 public MainPage()
 {
     this.InitializeComponent();
     var ftx = new FreeTextBox();
 }
Ejemplo n.º 7
0
    public void CreateFields()
    {
        string tableName = ((System.Data.Linq.Mapping.TableAttribute)DataType.GetCustomAttributes(typeof(System.Data.Linq.Mapping.TableAttribute), false).First()).Name;

        MonkData db = new MonkData();

        PropertyInfo[] properties = DataType.GetProperties();
        // Look at each property on the object type
        foreach (PropertyInfo prop in properties)
        {
            Type propertyType = prop.PropertyType;

            object[] attributes = prop.GetCustomAttributes(false);
            if (attributes.Count() > 0)
                if (attributes[0].GetType() == typeof(ColumnAttribute))
                {
                    ColumnAttribute column = (ColumnAttribute)attributes[0];

                    if (column.DbType.Contains("Text"))
                    {
                        CreateFieldName(prop);
                        CreateLineBreak();
                        // Show cool edit textbox
                        FreeTextBoxControls.FreeTextBox textBox = new FreeTextBox();
                        textBox.Width = new Unit(920);
                        textBox.Height = new Unit(350);
                        textBox.ID = prop.Name;
                        plcForm.Controls.Add(textBox);
                        CreateLineBreak();

                    }
                    else if (column.DbType.Contains("Decimal"))
                    {
                        CreateFieldName(prop);
                        CreateLineBreak();
                        TextBox txtDecimal = new TextBox();
                        if (!Page.IsPostBack)
                            txtDecimal.Text = "0.00";
                        txtDecimal.ID = prop.Name;
                        plcForm.Controls.Add(txtDecimal);
                        RequiredFieldValidator reqDecimal = new RequiredFieldValidator();
                        reqDecimal.ControlToValidate = prop.Name;
                        reqDecimal.Text = "Required Decimal Number";
                        reqDecimal.ID = "reqDecimal_" + prop.Name;
                        reqDecimal.ValidationGroup = "AddEdit";
                        plcForm.Controls.Add(reqDecimal);
                        CreateLineBreak();
                    }
                    else if (column.DbType.Contains("Bit"))
                    {
                        CheckBox chkBox = new CheckBox();
                        chkBox.ID = prop.Name;
                        plcForm.Controls.Add(chkBox);
                        CreateFieldName(prop);
                        CreateLineBreak();

                    }
                    else if (column.DbType.Contains("VarChar") || column.DbType.Contains("NChar"))
                    {

                        int maxLength = 8000;
                        string number = column.DbType.Replace("NVarChar", "").Replace("NChar", "").Replace("VarChar", "").Replace("(", "").Replace(")", "").Replace(" NOT NULL", "");

                        if (number.Contains("N128"))
                        {

                        }

                        if (number.Contains("MAX") || number.Contains("max"))
                        {
                            maxLength = 8000;
                        }
                        else
                        {
                            maxLength = int.Parse(number);
                        }

                        CreateFieldName(prop);
                        CreateLineBreak();
                        // Get the max length of the varchar
                        TextBox txtBox = new TextBox();
                        txtBox.ID = prop.Name;
                        txtBox.MaxLength = maxLength;
                        plcForm.Controls.Add(txtBox);

                        CreateLineBreak();
                    }
                    else if (column.DbType == "UniqueIdentifier")
                    {
                        // Don't show GUID columns
                    }
                    else if (column.DbType.Contains("DateTime"))
                    {
                        CreateFieldName(prop);
                        CreateLineBreak();
                        // Get the max length of the varchar
                        TextBox txtBox = new TextBox();
                        txtBox.ID = prop.Name;

                        if (ItemId == null && !Page.IsPostBack)
                            txtBox.Text = DateTime.Now.ToShortDateString();

                        plcForm.Controls.Add(txtBox);

                        // Validate date information in box.
                        RegularExpressionValidator regVal = new RegularExpressionValidator();
                        regVal.ID = "reg" + prop.Name;
                        regVal.ControlToValidate = txtBox.ID;
                        regVal.Text = "Must be in the format of '1:01 AM' or 23:52:01";
                        regVal.ValidationExpression = @"(?=\d)^(?:(?!(?:10\D(?:0?[5-9]|1[0-4])\D(?:1582))|(?:0?9\D(?:0?[3-9]|1[0-3])\D(?:1752)))((?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)(?!-31)(?!\.31)|(?:0?2(?=.?(?:(?:29.(?!000[04]|(?:(?:1[^0-6]|[2468][^048]|[3579][^26])00))(?:(?:(?:\d\d)(?:[02468][048]|[13579][26])(?!\x20BC))|(?:00(?:42|3[0369]|2[147]|1[258]|09)\x20BC))))))|(?:0?2(?=.(?:(?:\d\D)|(?:[01]\d)|(?:2[0-8])))))([-.\/])(0?[1-9]|[12]\d|3[01])\2(?!0000)((?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?!\x20BC)))\d{4}(?:\x20BC)?)(?:$|(?=\x20\d)\x20))?((?:(?:0?[1-9]|1[012])(?::[0-5]\d){0,2}(?:\x20[aApP][mM]))|(?:[01]\d|2[0-3])(?::[0-5]\d){1,2})?$";
                        regVal.ValidationGroup = "AddEdit";
                        plcForm.Controls.Add(regVal);

                        // Add ajax popup calendar for date selection
                        AjaxControlToolkit.CalendarExtender popupCal = new AjaxControlToolkit.CalendarExtender();
                        popupCal.ID = "popCal" + prop.Name;
                        popupCal.TargetControlID = txtBox.ID;
                        popupCal.Format = "MM/dd/yyyy";
                        plcForm.Controls.Add(popupCal);

                        CreateLineBreak();
                    }
                    else if (column.DbType.Contains("Int"))
                    {
                        int maxLength = 10;
                        CreateFieldName(prop);
                        CreateLineBreak();
                        TextBox txtBox = new TextBox();
                        txtBox.ID = prop.Name;
                        txtBox.MaxLength = maxLength;
                        if (!Page.IsPostBack)
                            txtBox.Text = "0";

                        plcForm.Controls.Add(txtBox);
                        RequiredFieldValidator reqInt = new RequiredFieldValidator();
                        reqInt.ID = "reqInt_" + prop.Name;
                        reqInt.Text = "Required integer number";
                        reqInt.ControlToValidate = txtBox.ID;
                        reqInt.ValidationGroup = "AddEdit";
                        plcForm.Controls.Add(reqInt);

                        CreateLineBreak();
                    }

                }
                else if (attributes[0].GetType() == typeof(AssociationAttribute))
                {
                    // Load a dropdown list
                    AssociationAttribute assocAttrib = (AssociationAttribute)attributes[0];
                    if (!String.IsNullOrEmpty(assocAttrib.ThisKey) && assocAttrib.IsForeignKey)
                    {
                        // The field that points to another table.
                        PropertyInfo sourcePropertyInfo = DataType.GetProperties().First(p => p.Name == assocAttrib.ThisKey);

                        // Create a dropdown list.
                        DropDownList dropList = new DropDownList();
                        dropList.ID = prop.Name;

                        // Get the type that is in the association that we're going to use.
                        Type typeOfItems;

                        typeOfItems = BuildManager.GetType("Monks." + prop.PropertyType.Name, true);

                        // Get the primary key for that type
                        PropertyInfo primaryKeyOfItems = GetPrimaryKeyProperty(typeOfItems);

                        // Get the property from the table
                        var matchingProperties = db.GetType().GetProperties().Where(p => p.Name.StartsWith(typeOfItems.Name.Substring(0, typeOfItems.Name.Length - 1))).OrderBy(p => p.Name.Length);

                        if (matchingProperties.Count() < 1)
                            continue;

                        IEnumerable itemsInTable = (IEnumerable)matchingProperties.First().GetValue(db, null);
                        if (sourcePropertyInfo.PropertyType.Name.Contains("Nullable"))
                            dropList.Items.Add(new ListItem("null", "null"));

                        string tableNameReferenceTable = ((System.Data.Linq.Mapping.TableAttribute)prop.PropertyType.GetCustomAttributes(typeof(System.Data.Linq.Mapping.TableAttribute), false).First()).Name;

                        XmlNode xmlReferenceTableRules = GetDatabaseTable(prop.PropertyType.Name);

                        XmlNode xmlDisplayPropertyName = null;
                        if (xmlReferenceTableRules != null)
                            xmlDisplayPropertyName = xmlReferenceTableRules.SelectSingleNode("TitleColumn");

                        // Loop over each item in the table
                        foreach (object item in itemsInTable)
                        {
                            // If the column is a string, create the object.
                            foreach (PropertyInfo itemPInfo in typeOfItems.GetProperties())
                            {
                                if (xmlDisplayPropertyName != null)
                                {
                                    if (xmlDisplayPropertyName.InnerText == itemPInfo.Name)
                                    {
                                        ListItem dListItem = new ListItem();

                                        dListItem.Text = itemPInfo.GetValue(item, null).ToString().Replace("&nbsp;", " - ");
                                        dListItem.Value = primaryKeyOfItems.GetValue(item, null).ToString();

                                        dropList.Items.Add(dListItem);
                                        break;
                                    }
                                }
                                else if (itemPInfo.PropertyType == typeof(string))
                                {
                                    ListItem dListItem = new ListItem();
                                    if (itemPInfo.GetValue(item, null) == null)
                                        continue;

                                    dListItem.Text = itemPInfo.GetValue(item, null).ToString();
                                    dListItem.Value = primaryKeyOfItems.GetValue(item, null).ToString();

                                    dropList.Items.Add(dListItem);
                                    break;
                                }

                            }
                        }
                        CreateFieldName(prop);
                        CreateLineBreak();
                        plcForm.Controls.Add(dropList);

                        HyperLink hlNewItem = new HyperLink();
                        hlNewItem.Style.Add(HtmlTextWriterStyle.PaddingLeft, "10px");
                        hlNewItem.NavigateUrl = "AddEdit.aspx?typename=" + typeOfItems.Name;
                        hlNewItem.Text = "Add New " + CreateFieldNameFromString(typeOfItems.Name);
                        plcForm.Controls.Add(hlNewItem);

                        Literal litSpace = new Literal();
                        litSpace.Text = " | ";
                        plcForm.Controls.Add(litSpace);

                        LinkButton lbtnViewCurrentSelectedItem = new LinkButton();
                        lbtnViewCurrentSelectedItem.Text = "View Selected Item";
                        lbtnViewCurrentSelectedItem.ID = "lbtnViewSelectedItem_" + prop.Name;
                        lbtnViewCurrentSelectedItem.Click += new EventHandler(lbtnViewCurrentSelectedItem_Clicked);
                        plcForm.Controls.Add(lbtnViewCurrentSelectedItem);

                        Literal litSpace2 = new Literal();
                        litSpace2.Text = " | ";
                        plcForm.Controls.Add(litSpace2);

                        HyperLink hlGridViewForDropDown = new HyperLink();
                        hlGridViewForDropDown.Text = "Search";
                        hlGridViewForDropDown.NavigateUrl = "GridView.aspx?typename=" + prop.PropertyType.Name;
                        plcForm.Controls.Add(hlGridViewForDropDown);

                        CreateLineBreak();
                    }
                }
        }
    }
        /// <summary>
        /// Initialises the control
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	12/13/2004	Documented
        /// </history>
        public override void Initialize()
        {
            //initialize the control
            cntlFtb = new FreeTextBox();
            cntlFtb.PreRender += new EventHandler( cntlFtb_PreRender );
            cntlFtb.Language = Thread.CurrentThread.CurrentUICulture.Name;
            cntlFtb.ButtonImagesLocation = ResourceLocation.ExternalFile;
            cntlFtb.JavaScriptLocation = ResourceLocation.ExternalFile;

            //Set Design Mode Css for WYSIWYG
// TODO AC When the style sheets are added, we get js errors resulting in nothing working, add this back at a later time.
//            SetDesignModeCss();

            cntlFtb.ToolbarImagesLocation = ResourceLocation.ExternalFile;
            cntlFtb.ID = ControlID;
            cntlFtb.AutoGenerateToolbarsFromString = false;

            //Build the Standard ToolBar Collection
            cntlFtb.Toolbars.Clear();
            cntlFtb.Toolbars.Add( AddStyleToolBar() );
            cntlFtb.Toolbars.Add( AddColorToolBar() );

            Toolbar tb = AddTextToolBar();
            if( tb.Items.Count > 0 )
            {
                cntlFtb.Toolbars.Add( AddTextToolBar() );
            }

            cntlFtb.Toolbars.Add( AddFormatToolBar() );
            cntlFtb.Toolbars.Add( AddEditToolBar() );
            cntlFtb.Toolbars.Add( AddInsertToolBar() );
            cntlFtb.Toolbars.Add( AddTableToolBar() );
            if( enableProFeatures )
            {
                cntlFtb.Toolbars.Add( AddFormToolBar() );
            }
            cntlFtb.Toolbars.Add( AddSpecialToolBar() );

            cntlFtb.ImageGalleryUrl = Globals.ResolveUrl( "~/Providers/HtmlEditorProviders/Ftb3HtmlEditorProvider/ftb3/ftb.imagegallery.aspx?cif=~" + RootImageDirectory + "&rif=~" + RootImageDirectory + "&portalid=" + PortalSettings.PortalId );
            cntlFtb.SupportFolder = Globals.ResolveUrl( "~/Providers/HtmlEditorProviders/Ftb3HtmlEditorProvider/ftb3/" );
            switch( toolbarStyle )
            {
                case "OfficeMac":

                    cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.OfficeMac;
                    break;
                case "Office2000":

                    cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.Office2000;
                    break;
                case "OfficeXP":

                    cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.OfficeXP;
                    break;
                case "Office2003":

                    cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.Office2003;
                    break;
                default:

                    cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.NotSet;
                    break;
            }
        }
        /// <summary>
        /// Gets the editor.
        /// </summary>
        /// <param name="PlaceHolderHTMLEditor">The place holder HTML editor.</param>
        /// <param name="moduleID">The module ID.</param>
        /// <param name="showUpload">if set to <c>true</c> [show upload].</param>
        /// <param name="portalSettings">The portal settings.</param>
        /// <returns></returns>
        public IHtmlEditor GetEditor(Control PlaceHolderHTMLEditor, int moduleID, bool showUpload,
                                     PortalSettings portalSettings)
        {
            IHtmlEditor DesktopText;
            string      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]
            string uniqueID = PlaceHolderHTMLEditor.ID;

            switch (Value)
            {
            case "FCKEditor V2":     // [email protected] 2004/11/09.
                FCKTextBoxV2 fckv2 = new FCKTextBoxV2();
                fckv2.ImageFolder        = moduleImageFolder;
                fckv2.BasePath           = Path.WebPathCombine(Path.ApplicationRoot, "aspnet_client/FCKEditorV2/");
                fckv2.AutoDetectLanguage = false;
                fckv2.DefaultLanguage    = portalSettings.PortalUILanguage.Name.Substring(0, 2);
//					fckv2.EditorAreaCSS = portalSettings.GetCurrentTheme().CssFile;
                fckv2.ID = string.Concat("FCKTextBox", uniqueID);
                string conector = Path.ApplicationRootPath("/app_support/FCKconnectorV2.aspx");
                fckv2.ImageBrowserURL =
                    Path.WebPathCombine(Path.ApplicationRoot,
                                        "aspnet_client/FCKEditorV2/editor/filemanager/browser.html?Type=Image&Connector=" +
                                        conector);
                fckv2.LinkBrowserURL =
                    Path.WebPathCombine(Path.ApplicationRoot,
                                        "aspnet_client/FCKEditorV2/editor/filemanager/browser.html?Connector=" +
                                        conector);
                DesktopText = ((IHtmlEditor)fckv2);
                break;

            case "FreeTextBox":
                FreeTextBox freeText = new 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";
                freeText.ImageGalleryUrl =
                    Path.WebPathCombine(Path.ApplicationFullPath,
                                        "app_support/ftb.imagegallery.aspx?rif={0}&cif={0}&mID=" +
                                        moduleID.ToString());
                freeText.ImageFolder      = moduleImageFolder;
                freeText.ImageGalleryPath = Path.WebPathCombine(portalSettings.PortalFullPath, freeText.ImageFolder);
                freeText.ID       = string.Concat("FreeText", uniqueID);
                freeText.Language = getFtbLanguage(portalSettings.PortalUILanguage.Name);
                DesktopText       = ((IHtmlEditor)freeText);
                break;

            case "ActiveUp HtmlTextBox":
                HtmlTextBox h = new HtmlTextBox();
                h.ImageFolder = moduleImageFolder;
                DesktopText   = (IHtmlEditor)h;

                // Allow content editors to see the content with the same style that it is displayed in
                h.ContentCssFile = portalSettings.GetCurrentTheme().CssFile;

                // Custom Properties must come after control is added to placeholder
                h.EnsureToolsCreated();

                // Set the icons folder
                h.IconsDir = Path.WebPathCombine(Path.ApplicationRoot, "aspnet_client/ActiveUp/icons/");

                // Add the Help icon
                StringBuilder sbHelp = new StringBuilder();
                sbHelp.Append("var Help=window.open('");
                sbHelp.Append(Path.ApplicationRoot);
                sbHelp.Append("/aspnet_client/ActiveUp/");
                sbHelp.Append(
                    "htmltextbox_help.html', 'HTML_TextBox_Help', 'height=520, width=520, resizable=yes, scrollbars=yes, menubar=no, toolbar=no, directories=no, location=no, status=no');Help.moveTo('20', '20');");
                Custom openPage = new Custom();
                openPage.IconOff           = "help_off.gif";
                openPage.IconOver          = "help_off.gif";
                openPage.ClientSideOnClick = sbHelp.ToString();
                h.Toolbars[0].Tools.Add(openPage);

                // Add the image library
                Image imageLibrary = (Image)h.Toolbars[0].Tools["Image"];
                imageLibrary.AutoLoad = true;

                // Clear the directories collection because it is stored in ViewState and must be cleared or upload will result in display of multiple directories of the same name
                imageLibrary.Directories.Clear();
                imageLibrary.Directories.Add("images",
                                             HttpContext.Current.Server.MapPath(portalSettings.PortalFullPath +
                                                                                h.ImageFolder),
                                             portalSettings.PortalFullPath + h.ImageFolder + "/");

                if (!showUpload)
                {
                    imageLibrary.UploadDisabled = true;
                }
                break;

            case "Plain Text":
            default:
                DesktopText = (new TextEditor());
                break;
            }
            PlaceHolderHTMLEditor.Controls.Add(((Control)DesktopText));
            return(DesktopText);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Initialises the control
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	12/13/2004	Documented
        /// </history>
        public override void Initialize()
        {
            //initialize the control
            cntlFtb                      = new FreeTextBox();
            cntlFtb.PreRender           += new EventHandler(cntlFtb_PreRender);
            cntlFtb.Language             = Thread.CurrentThread.CurrentUICulture.Name;
            cntlFtb.ButtonImagesLocation = ResourceLocation.ExternalFile;
            cntlFtb.JavaScriptLocation   = ResourceLocation.ExternalFile;

            //Set Design Mode Css for WYSIWYG
// TODO AC When the style sheets are added, we get js errors resulting in nothing working, add this back at a later time.
//            SetDesignModeCss();

            cntlFtb.ToolbarImagesLocation = ResourceLocation.ExternalFile;
            cntlFtb.ID = ControlID;
            cntlFtb.AutoGenerateToolbarsFromString = false;

            //Build the Standard ToolBar Collection
            cntlFtb.Toolbars.Clear();
            cntlFtb.Toolbars.Add(AddStyleToolBar());
            cntlFtb.Toolbars.Add(AddColorToolBar());

            Toolbar tb = AddTextToolBar();

            if (tb.Items.Count > 0)
            {
                cntlFtb.Toolbars.Add(AddTextToolBar());
            }

            cntlFtb.Toolbars.Add(AddFormatToolBar());
            cntlFtb.Toolbars.Add(AddEditToolBar());
            cntlFtb.Toolbars.Add(AddInsertToolBar());
            cntlFtb.Toolbars.Add(AddTableToolBar());
            if (enableProFeatures)
            {
                cntlFtb.Toolbars.Add(AddFormToolBar());
            }
            cntlFtb.Toolbars.Add(AddSpecialToolBar());

            cntlFtb.ImageGalleryUrl = Globals.ResolveUrl("~/Providers/HtmlEditorProviders/Ftb3HtmlEditorProvider/ftb3/ftb.imagegallery.aspx?cif=~" + RootImageDirectory + "&rif=~" + RootImageDirectory + "&portalid=" + PortalSettings.PortalId);
            cntlFtb.SupportFolder   = Globals.ResolveUrl("~/Providers/HtmlEditorProviders/Ftb3HtmlEditorProvider/ftb3/");
            switch (toolbarStyle)
            {
            case "OfficeMac":

                cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.OfficeMac;
                break;

            case "Office2000":

                cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.Office2000;
                break;

            case "OfficeXP":

                cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.OfficeXP;
                break;

            case "Office2003":

                cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.Office2003;
                break;

            default:

                cntlFtb.ToolbarStyleConfiguration = ToolbarStyleConfiguration.NotSet;
                break;
            }
        }