/// <summary>
        /// Raises OnInitEvent
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            var editor = ModuleSettings["Editor"].ToString();
            var width = this.ModuleSettings["Width"].ToString();
            var height = this.ModuleSettings["Height"].ToString();
            var showUpload = this.ModuleSettings["ShowUpload"].ToBoolean(CultureInfo.InvariantCulture);

            var h = new HtmlEditorDataType { Value = editor };
            this.DesktopText = h.GetEditor(
                this.PlaceHolderComponentEditor,
                this.ModuleID,
                showUpload,
                this.PortalSettings);

            this.DesktopText.Width = new Unit(width);
            this.DesktopText.Height = new Unit(height);

            //Translate
            // Added EsperantusKeys for Localization
            // Mario Endara [email protected] june-1-2004
            RequiredTitle.ErrorMessage = General.GetString("ERROR_VALID_TITLE");
            //RequiredComponent.ErrorMessage = General.GetString("ERROR_VALID_DESCRIPTION");

            this.Load += new EventHandler(this.Page_Load);
            this.UpdateButton.Click += new EventHandler(updateButton_Click);

            base.OnInit(e);
        }
예제 #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">
        /// An <see cref="T:System.EventArgs"/> object that contains the event data.
        /// </param>
        protected override void OnInit(EventArgs e)
        {
            this.To  = new EmailAddressList();
            this.Cc  = new EmailAddressList();
            this.Bcc = new EmailAddressList();

            var h  = new HtmlEditorDataType();
            var pS = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

            try
            {
                h.Value      = pS.CustomSettings["SITESETTINGS_DEFAULT_EDITOR"].ToString();
                this.txtBody = h.GetEditor(
                    this.PlaceHolderHTMLEditor,
                    int.Parse(this.Context.Request["mID"]),
                    bool.Parse(pS.CustomSettings["SITESETTINGS_SHOWUPLOAD"].ToString()),
                    pS);
            }
            catch
            {
                this.txtBody = h.GetEditor(this.PlaceHolderHTMLEditor, int.Parse(this.Context.Request["mID"]), true, pS);
            }

            this.lblEmailAddressesNotOk.Text = General.GetString(
                "EMF_ADDRESSES_NOT_OK", "The emailaddresses are not ok.", this.lblEmailAddressesNotOk);

            this.txtTo.Text  = string.Join(";", (string[])this.To.ToArray(typeof(string)));
            this.txtCc.Text  = string.Join(";", (string[])this.Cc.ToArray(typeof(string)));
            this.txtBcc.Text = string.Join(";", (string[])this.Bcc.ToArray(typeof(string)));

            base.OnInit(e);
        }
예제 #3
0
        public Root(IHtmlEditor editor, string sTemp, string sPath)
            : base(editor, null, sTemp, sPath, null, -1)
        {
            oXmlMgr = new XmlManager(this);

            // public "property"
            this.selectedRegion = null;
            this.selectedIndex  = -1;
            this.focusField     = null;
            this.popupOwner     = null;

            // doc mgmt vars
            this.oEditXml = null;
            this.nextID   = 0;
            this.dChanges = new Dictionary <XmlNode, List <EdxNode> >();
            this.dIDs     = new Dictionary <string, EdxNode>();
            this.oXmlMgr  = new XmlManager(this);

            // manage field selection
            this.aFieldSelection = null;

            // catch global events
            //IElement body = editor.GetBodyElement();
            //body.SelectionChange += new GuruComponents.Netrix.Events.DocumentEventHandler(Root_SelectionChange);

            // assign ourselves our ID
            this.id = this.AssignID(this);
        }
        /// <summary>
        /// Raises OnInitEvent
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            var editor     = ModuleSettings["Editor"].ToString();
            var width      = this.ModuleSettings["Width"].ToString();
            var height     = this.ModuleSettings["Height"].ToString();
            var showUpload = this.ModuleSettings["ShowUpload"].ToBoolean(CultureInfo.InvariantCulture);

            var h = new HtmlEditorDataType {
                Value = editor
            };

            this.DesktopText = h.GetEditor(
                this.PlaceHolderComponentEditor,
                this.ModuleID,
                showUpload,
                this.PortalSettings);

            this.DesktopText.Width  = new Unit(width);
            this.DesktopText.Height = new Unit(height);


            //Translate
            // Added EsperantusKeys for Localization
            // Mario Endara [email protected] june-1-2004
            RequiredTitle.ErrorMessage = General.GetString("ERROR_VALID_TITLE");
            //RequiredComponent.ErrorMessage = General.GetString("ERROR_VALID_DESCRIPTION");

            this.Load += new EventHandler(this.Page_Load);
            this.UpdateButton.Click += new EventHandler(updateButton_Click);

            base.OnInit(e);
        }
 public ElementSelectedBehavior(IHtmlEditor host) : base(host)
 {
     BorderMargin             = new Rectangle(2, 2, 2, 2);
     BorderPenStyle           = new Pen(new SolidBrush(Color.Black));
     BorderPenStyle.DashStyle = DashStyle.DashDot;
     BorderPenStyle.Width     = 2F;
 }
예제 #6
0
        /// <summary>
        /// Constructor for event arguments.
        /// </summary>
        /// <remarks>
        /// Used internally to support NetRix infrastructure. There is no need to call this constructor directly.
        /// </remarks>
        /// <param name="editor"></param>
        /// <param name="el"></param>
        /// <param name="pVar"></param>
        /// <param name="rect"></param>
        public AfterSnapRectEventArgs(IHtmlEditor editor, Interop.IHTMLElement el, Interop.RECT rect, Interop.ELEMENT_CORNER pVar)
        {
            element   = editor.GenericElementFactory.CreateElement(el);
            rectangle = new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);

            zone = (SnapZone)(int)pVar;
        }
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        /// of the xml module to edit.
        /// It then uses the Rainbow.HtmlTextDB() data component
        /// to populate the page's edit controls with the text details.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Add the setting
            HtmlEditorDataType h = new HtmlEditorDataType();

            h.Value     = moduleSettings["Editor"].ToString();
            DesktopText =
                h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()),
                            portalSettings);
            DesktopText.Width  = new Unit(moduleSettings["Width"].ToString());
            DesktopText.Height = new Unit(moduleSettings["Height"].ToString());
            if (bool.Parse(moduleSettings["ShowMobile"].ToString()))
            {
                MobileRow.Visible   = true;
                MobileSummary.Width = new Unit(moduleSettings["Width"].ToString());
                MobileDetails.Width = new Unit(moduleSettings["Width"].ToString());
            }
            else
            {
                MobileRow.Visible = false;
            }
            // Construct the page
            // Added css Styles by Mario Endara <*****@*****.**> (2004/10/26)
            updateButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(updateButton);
            PlaceHolderButtons.Controls.Add(new LiteralControl("&#160;"));
            cancelButton.CssClass = "CommandButton";
            PlaceHolderButtons.Controls.Add(cancelButton);
            if (Page.IsPostBack == false)
            {
                // Obtain a single row of text information
                HtmlTextDB text = new HtmlTextDB();
                // Change by [email protected] - Date: 7/2/2003
                // Original: SqlDataReader dr = text.GetHtmlText(ModuleID);
                SqlDataReader dr = text.GetHtmlText(ModuleID, WorkFlowVersion.Staging);
                // End Change [email protected]
                try
                {
                    if (dr.Read())
                    {
                        DesktopText.Text   = Server.HtmlDecode((string)dr["DesktopHtml"]);
                        MobileSummary.Text = Server.HtmlDecode((string)dr["MobileSummary"]);
                        MobileDetails.Text = Server.HtmlDecode((string)dr["MobileDetails"]);
                    }
                    else
                    {
                        DesktopText.Text =
                            General.GetString("HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                        MobileSummary.Text =
                            General.GetString("HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                        MobileDetails.Text =
                            General.GetString("HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);
                    }
                }
                finally
                {
                    dr.Close();
                }
            }
        }
예제 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);

            _to  = new EmailAddressList();
            _cc  = new EmailAddressList();
            _bcc = new EmailAddressList();

            HtmlEditorDataType h  = new HtmlEditorDataType();
            PortalSettings     pS = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

            try
            {
                h.Value = pS.CustomSettings["SITESETTINGS_DEFAULT_EDITOR"].ToString();
                txtBody =
                    h.GetEditor(PlaceHolderHTMLEditor, int.Parse(Context.Request["mID"]),
                                bool.Parse(pS.CustomSettings["SITESETTINGS_SHOWUPLOAD"].ToString()), pS);
            }
            catch
            {
                txtBody = h.GetEditor(PlaceHolderHTMLEditor, int.Parse(Context.Request["mID"]), true, pS);
            }

            lblEmailAddressesNotOk.Text =
                General.GetString("EMF_ADDRESSES_NOT_OK", "The emailaddresses are not ok.", lblEmailAddressesNotOk);
        }
예제 #9
0
 /// <summary>
 /// This constructor builds a new helpline object with given coordinates.
 /// </summary>
 /// <param name="host">The related control</param>
 /// <param name="helpLine">Properties</param>
 /// <param name="extender">Reference to editor component.</param>
 internal HelpLineBehavior(IHtmlEditor host, HelpLineProperties helpLine, HelpLine extender) : base(host)
 {
     _host = host;
     _host.ReadyStateComplete += new EventHandler(_host_ReadyStateComplete);
     // store the instances to help the behavior to work on multiple extenders
     instance      = instanceCounter++;
     this.extender = extender;
     _snapToGrid   = helpLine.SnapToGrid;
     _snapgrid     = helpLine.SnapGrid;
     // assure a valid value, avoid Div by zero
     if (_snapToGrid && _snapgrid == 0)
     {
         _snapgrid = 16;
     }
     snapZone            = helpLine.SnapZone;
     base.HtmlPaintFlag  = HtmlPainter.Transparent;
     base.HtmlZOrderFlag = HtmlZOrder.AboveContent;
     _style        = new Pen(helpLine.LineColor, (float)helpLine.LineWidth);
     _lineVisible  = helpLine.LineVisible;
     _snapelements = helpLine.SnapElements;
     _lineXEnabled = helpLine.LineXEnabled;
     _lineYEnabled = helpLine.LineYEnabled;
     _crossEnabled = helpLine.CrossEnabled;
     this.x        = helpLine.X;
     this.y        = helpLine.Y;
 }
예제 #10
0
        public ElementDom(Interop.IHTMLDOMNode element, IHtmlEditor htmlEditor)
        {
            this.node       = element;
            this.htmlEditor = htmlEditor;
            if (element.nodeType == 0)
            {
                nodeType = System.Xml.XmlNodeType.Attribute;
            }
            else
            {
                switch (element.nodeType)
                {
                case 1:
                    nodeType = System.Xml.XmlNodeType.Element;
                    break;

                case 3:
                    nodeType = System.Xml.XmlNodeType.Text;
                    break;

                default:
                    nodeType = System.Xml.XmlNodeType.None;
                    break;
                }
            }
        }
예제 #11
0
        internal MapElement(Interop.IHTMLElement peer, IHtmlEditor editor) : base(peer, editor)
        {
            _areaElements = new AreaElementsCollection();
            FillAreaCollection();
            MapAreaBehavior b = new MapAreaBehavior(editor);

            base.ElementBehaviors.AddBehavior(b);
        }
예제 #12
0
 public WindowsEvents(Interop.IHTMLWindow2 window, IHtmlEditor editor, IHtmlWindow htmlWindow)
 {
     this.window     = window;
     this.editor     = editor;
     this.htmlWindow = (GuruComponents.Netrix.WebEditing.Documents.HtmlWindow)htmlWindow;
     this.ConnectWindow();
     this.ConnectDocument();
 }
예제 #13
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="editor"></param>
 public DesignerProperties(IHtmlEditor editor)
 {
     this.active                 = true;
     this.expandUserControls     = true;
     this.requireServerAttribute = true;
     this.editor                 = editor;
     this.loadAscx               = true;
 }
예제 #14
0
 /// <summary>
 /// Constructor for region class.
 /// </summary>
 /// <param name="editor"></param>
 /// <param name="p"></param>
 /// <param name="sTemp"></param>
 /// <param name="sPath"></param>
 /// <param name="sOptions"></param>
 /// <param name="index"></param>
 public Region(IHtmlEditor editor, EdxNode p, string sTemp, string sPath, string sOptions, int index) : base(editor, p, sTemp, sPath, sOptions, index)
 {
     base.parent = p;
     // init class vars
     this.saveBackground  = Color.Empty;
     this.viewState       = null;
     this.displayLinkNode = null;
 }
예제 #15
0
 public UndoStack(string description, UndoManager manager, IHtmlEditor editor)
 {
     _description = description;
     _childUndos  = new List <UndoUnit>();
     _startIndex  = 0;
     _numUndos    = 0;
     _undoManager = manager;
 }
예제 #16
0
 /// <summary>
 /// Supports VIDEO inheritance only.
 /// </summary>
 /// <param name="tagname"></param>
 /// <param name="editor"></param>
 protected AudioElement(string tagname, IHtmlEditor editor)
     : base(tagname, editor)
 {
     if (!tagname.Equals("video"))
     {
         throw new System.ArgumentException();
     }
 }
예제 #17
0
        internal static string BuildUniqueName(IElement tag, IHtmlEditor htmlEditor)
        {
            //// Build a unique name
            IDesignerHost host = (IDesignerHost)htmlEditor.ServiceProvider.GetService(typeof(IDesignerHost));

            GuruComponents.Netrix.Designer.NameCreationService nc = (GuruComponents.Netrix.Designer.NameCreationService)htmlEditor.ServiceProvider.GetService(typeof(System.ComponentModel.Design.Serialization.INameCreationService));
            return(nc.CreateName(host.Container, tag.GetType()));
        }
예제 #18
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="editor"></param>
 /// <param name="peer"></param>
 /// <param name="behavior"></param>
 internal AscxElement(IHtmlEditor editor, Interop.IHTMLElement peer, DesignTimeBehavior behavior)
 {
     this.editor   = editor;
     this.peer     = peer;
     this.peer2    = (Interop.IHTMLElement2)peer;
     this.peer3    = (Interop.IHTMLElement3)peer;
     this.behavior = behavior;
 }
예제 #19
0
 internal BaseHighLightCell(Interop.IHTMLTableCell Cell, IHtmlEditor htmlEditor)
 {
     if (Cell != null)
     {
         GenericCell = (Interop.IHTMLElement)Cell;
         m_Col       = Cell.cellIndex;
         m_Row       = ((Interop.IHTMLTableRow)((Interop.IHTMLElement)Cell).GetParentElement()).rowIndex;
     }
 }
예제 #20
0
 public UndoManager(string stackName, IHtmlEditor editor)
 {
     if (oleUndoManagerInstance == null)
     {
         throw new ArgumentNullException("Improper Undo Manager call");
     }
     _stackName  = stackName;
     _startIndex = CountUndos();
 }
예제 #21
0
 internal static GlobalEvents GetGlobalEventsFactory(IHtmlEditor htmlEditor)
 {
     if (ge[htmlEditor] == null)
     {
         ge[htmlEditor] = new GlobalEvents();
         ((GlobalEvents)ge[htmlEditor]).htmlEditor = htmlEditor;
     }
     return(ge[htmlEditor] as GlobalEvents);
 }
예제 #22
0
 internal NamespaceManager(IHtmlEditor editor)
 {
     _editor = (HtmlEditor)editor;
     _registeredNamespaces = new Dictionary <string, string>();
     _registeredBehaviors  = new Dictionary <string, Type>();
     _behaviorInstances    = new Dictionary <Interop.IHTMLElement, IBaseBehavior>();
     _editor.Saving       += new SaveEventHandler(_editor_Saving);
     _editor.Saved        += new SaveEventHandler(_editor_Saved);
 }
예제 #23
0
        /// <summary>
        /// Handles OnInit event
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param>
        /// <remarks>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        ///   of the xml module to edit.
        ///   It then uses the Appleseed.HtmlTextDB() data component
        ///   to populate the page's edit controls with the text details.
        /// </remarks>
        protected override void OnInit(EventArgs e)
        {
            // Controls must be created here
            this.UpdateButton = new LinkButton();
            this.CancelButton = new LinkButton();

            // Add the setting
            var editor = this.ModuleSettings["Editor"].ToString();
            var width = this.ModuleSettings["Width"].ToString();
            var height = this.ModuleSettings["Height"].ToString();
            var showUpload = this.ModuleSettings["ShowUpload"].ToBoolean(CultureInfo.InvariantCulture);

            var h = new HtmlEditorDataType { Value = editor };
            this.DesktopText = h.GetEditor(
                this.PlaceHolderHTMLEditor,
                this.ModuleID,
                showUpload,
                this.PortalSettings);

            this.DesktopText.Width = new Unit(width);
            this.DesktopText.Height = new Unit(height);

            // Construct the page
            // Added css Styles by Mario Endara <*****@*****.**> (2004/10/26)
            this.UpdateButton.CssClass = "CommandButton";
            this.PlaceHolderButtons.Controls.Add(this.UpdateButton);
            this.PlaceHolderButtons.Controls.Add(new LiteralControl("&#160;"));
            this.CancelButton.CssClass = "CommandButton";
            this.CancelButton.ID = "EditHtmlCancelButton";
            this.PlaceHolderButtons.Controls.Add(this.CancelButton);

            // Obtain a single row of text information
            var text = new HtmlTextDB();

            // Change by [email protected] - Date: 7/2/2003
            // Original: SqlDataReader dr = text.GetHtmlText(ModuleID);
            var dr = text.GetHtmlText(this.ModuleID, WorkFlowVersion.Staging);

            // End Change [email protected]
            try {
                if (dr.Read()) {
                    this.DesktopText.Text = this.Server.HtmlDecode((string)dr["DesktopHtml"]);

                } else {
                    this.DesktopText.Text = General.GetString(
                        "HTMLDOCUMENT_TODO_ADDCONTENT", "Todo: Add Content...", null);

                }
            } finally {
                dr.Close();
            }

            this.dialogclass.Attributes.Add("class", this.ModuleID.ToString());

            base.OnInit(e);
        }
        /// <summary>
        /// The Page_Load event handler on this User Control is used to
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["SortField"] = string.Empty;
                ViewState["SortOrder"] = string.Empty;

                if (IsEditable)
                {
                    cmdManage.Visible = true;
                }
                else
                {
                    cmdManage.Visible = false;
                }
            }

            if (Settings["XSLsrc"].ToString().Length > 0 || bool.Parse(Settings["DisplayAsXML"].ToString()) == true)
            {
                xmlControl              = new UserDefinedTableXML(XmlDataView(), PageID, ModuleIDsrc(), IsEditable, GetSortField(), GetSortOrder());
                xmlControl.SortCommand += new UDTXSLSortEventHandler(xmlData_Sort);

                if (bool.Parse(Settings["DisplayAsXML"].ToString()) == true)
                {
                    //Show Raw XML
                    xmlText        = new TextEditor();
                    xmlText.Text   = xmlControl.InnerXml;
                    xmlText.Width  = 450;
                    xmlText.Height = 400;
                    PlaceHolderOutput.Controls.Add((Control)xmlText);
                }
                else
                {
                    //Show XSL data
                    PlaceHolderOutput.Controls.Add(xmlControl);
                    BindXSL();
                }
            }
            else
            {
                //Show datagrid
                grdData                      = new DataGrid();
                grdData.BorderWidth          = 0;
                grdData.CellPadding          = 4;
                grdData.AutoGenerateColumns  = false;
                grdData.HeaderStyle.CssClass = "NormalBold";
                grdData.ItemStyle.CssClass   = "Normal";
                grdData.AllowSorting         = true;
                grdData.SortCommand         += new DataGridSortCommandEventHandler(grdData_Sort);
                PlaceHolderOutput.Controls.Add(grdData);
                BindGrid();
            }
            //Rob Siera - 04 nov 2004 - Show ManageButton only when having Permission to edit Properties
            cmdManage.Visible = ArePropertiesEditable;
        }
예제 #25
0
        private VmlDesignerBehavior EnsureBehaviorExists(IHtmlEditor key)
        {
            VmlDesignerBehavior b = (VmlDesignerBehavior)behaviors[key];

            if (b == null)
            {
                b = new VmlDesignerBehavior(key as IHtmlEditor, EnsurePropertiesExists(key), this);
                behaviors[key] = b;
            }
            return(b);
        }
예제 #26
0
 internal TableEventArgs(Interop.IHTMLElement table, IHtmlEditor htmlEditor)
 {
     if (table != null)
     {
         _table = (IElement)htmlEditor.GenericElementFactory.CreateElement(table);
     }
     else
     {
         _table = null;
     }
 }
예제 #27
0
        private SpellCheckerProperties EnsurePropertiesExists(IHtmlEditor key)
        {
            SpellCheckerProperties p = (SpellCheckerProperties)properties[key];

            if (p == null)
            {
                p = new SpellCheckerProperties(EnsureSpellCheckerExists(key));
                properties[key] = p;
            }
            return(p);
        }
예제 #28
0
        private VmlDesignerProperties EnsurePropertiesExists(IHtmlEditor key)
        {
            VmlDesignerProperties p = (VmlDesignerProperties)properties[key];

            if (p == null)
            {
                p = new VmlDesignerProperties();
                properties[key] = p;
            }
            return(p);
        }
예제 #29
0
        private HelpLineBehavior EnsureBehaviorExists(IHtmlEditor key)
        {
            HelpLineBehavior b = (HelpLineBehavior)behaviors[key];

            if (b == null)
            {
                b = new HelpLineBehavior(key as IHtmlEditor, EnsurePropertiesExists(key), this);
                behaviors[key] = b;
            }
            return(b);
        }
예제 #30
0
        internal static DesignerProperties EnsurePropertiesExists(IHtmlEditor key)
        {
            DesignerProperties p = (DesignerProperties)properties[key];

            if (p == null)
            {
                p = new DesignerProperties(key);
                properties[key] = p;
            }
            return(p);
        }
예제 #31
0
        private HelpLineProperties EnsurePropertiesExists(IHtmlEditor key)
        {
            HelpLineProperties p = (HelpLineProperties)properties[key];

            if (p == null)
            {
                p = new HelpLineProperties();
                properties[key] = p;
            }
            return(p);
        }
예제 #32
0
 internal EmbeddedBaseElement(Interop.IHTMLElement peer, IHtmlEditor editor) : base(peer, editor)
 {
     Interop.IHTMLObjectElement o = (Interop.IHTMLObjectElement)peer;
     if (_params == null)
     {
         _params = new ParameterElementsCollection(o);
         _params.OnInsertHandler += new CollectionInsertHandler(_param_OnInsertHandler);
         _params.OnClearHandler  += new CollectionClearHandler(_param_OnClearHandler);
     }
     SynchParams(peer);
 }
예제 #33
0
        public static void InsertTable(IHtmlEditor htmlEditor, IHtmlEditorComponentContext editorContext, TableCreationParameters parameters)
        {
            // note whether we are inserting into mshtml
            bool insertingIntoMshtml = editorContext != null;

            // build table html
            StringBuilder tableHtml = new StringBuilder();

            // clip the width if necessary (if inserting a table within another table cell)
            if (insertingIntoMshtml)
            {
                IHTMLElement2 parentCellBlock = editorContext.Selection.SelectedMarkupRange.Start.GetParentElement(ElementFilters.BLOCK_OR_TABLE_CELL_ELEMENTS) as IHTMLElement2;
                if (parentCellBlock is IHTMLTableCell)
                {
                    int parentCellWidth = parentCellBlock.clientWidth != 0 ? parentCellBlock.clientWidth : parentCellBlock.scrollWidth;
                    parameters.Properties.Width = Math.Min(parentCellWidth, parameters.Properties.Width);
                }
            }

            // table properties
            TableProperties properties = parameters.Properties;
            StringBuilder propertiesString = new StringBuilder();
            if (properties.Width.Units != PixelPercentUnits.Undefined)
                propertiesString.AppendFormat("width=\"{0}\"", properties.Width);
            if (properties.BorderSize != String.Empty)
                propertiesString.AppendFormat(" border=\"{0}\"", properties.BorderSize);
            if (properties.CellPadding != String.Empty)
                propertiesString.AppendFormat(" cellpadding=\"{0}\"", properties.CellPadding);
            if (properties.CellSpacing != String.Empty)
                propertiesString.AppendFormat(" cellspacing=\"{0}\"", properties.CellSpacing);

            // begin table
            tableHtml.AppendFormat("<table {0} unselectable=\"on\">\r\n", propertiesString.ToString());
            tableHtml.Append("<tbody>\r\n");

            // write cells
            string columnWidth = String.Empty;

            switch (parameters.Properties.Width.Units)
            {
                case PixelPercentUnits.Pixels:
                    int width = parameters.Properties.Width / parameters.Columns;
                    columnWidth = string.Format(" width=\"{0}\"", width);
                    break;
                case PixelPercentUnits.Percentage:
                    columnWidth = string.Format(" width=\"{0}%\"", 100 / parameters.Columns);
                    break;
            }

            for (int r = 0; r < parameters.Rows; r++)
            {
                tableHtml.Append("<tr>\r\n");

                for (int c = 0; c < parameters.Columns; c++)
                {
                    // add default alignment and width to each cell
                    string valign = " valign=\"top\""; //    (more natural/expected behavior than middle)
                    tableHtml.AppendFormat("<td {0}{1}></td>\r\n", valign, columnWidth);
                }

                tableHtml.Append("</tr>\r\n");
            }

            // end table
            tableHtml.Append("</tbody>\r\n");
            tableHtml.Append("</table>\r\n");

            // if we have an mshml selection, save it before inserting (so we can locate the table after insert)
            MarkupRange targetMarkupRange = null;
            if (insertingIntoMshtml)
            {
                targetMarkupRange = editorContext.Selection.SelectedMarkupRange.Clone();
                targetMarkupRange.Start.Gravity = _POINTER_GRAVITY.POINTER_GRAVITY_Left;
                targetMarkupRange.End.Gravity = _POINTER_GRAVITY.POINTER_GRAVITY_Right;
            }

            IDisposable insertionNotification = null;
            if (insertingIntoMshtml)
            {
                insertionNotification = new HtmlEditorControl.InitialInsertionNotify((HtmlEditorControl)editorContext);
            }

            using (insertionNotification)
            {
                // insert the table
                htmlEditor.InsertHtml(tableHtml.ToString(), false);

                // select the first cell for editing if we have an mshtml selection
                if (insertingIntoMshtml)
                {
                    IHTMLElement[] cells = targetMarkupRange.GetElements(ElementFilters.TABLE_CELL_ELEMENT, true);
                    if (cells.Length > 0)
                    {
                        SelectCell(editorContext, cells[0] as IHTMLTableCell);
                    }
                }
            }
        }
    /// <summary>
    /// Overridden CreateChildControls method.
    /// </summary>
    protected override void CreateChildControls()
    {
        SetupControl();

        Controls.Clear();
        base.CreateChildControls();

        if (!StopProcessing)
        {
            if (!CMSAbstractEditableControl.RequestEditViewMode(ViewMode, ContentID))
            {
                ViewMode = ViewModeEnum.Preview;
            }

            // Create controls by actual page mode
            switch (ViewMode)
            {
                case ViewModeEnum.Edit:
                case ViewModeEnum.EditDisabled:

                    // Main editor panel
                    pnlEditor = new Panel();
                    pnlEditor.ID = "pnlEditor";
                    pnlEditor.CssClass = "EditableTextEdit EditableText_" + ContentID;
                    Controls.Add(pnlEditor);

                    // Title label
                    lblTitle = new Label();
                    lblTitle.EnableViewState = false;
                    lblTitle.CssClass = "EditableTextTitle";
                    pnlEditor.Controls.Add(lblTitle);

                    // Error label
                    lblError = new Label();
                    lblError.EnableViewState = false;
                    lblError.CssClass = "EditableTextError";
                    pnlEditor.Controls.Add(lblError);

                    // Display the region control based on the region type
                    switch (RegionType)
                    {
                        case CMSEditableRegionTypeEnum.HtmlEditor:
                            // HTML Editor
                            htmlValue = new CMSHtmlEditor();
                            htmlValue.IsLiveSite = false;
                            htmlValue.ID = "htmlValue";
                            htmlValue.AutoDetectLanguage = false;
                            htmlValue.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;

                            // Set direction
                            htmlValue.Config["ContentsLangDirection"] = "ltr";

                            if (CultureHelper.IsPreferredCultureRTL())
                            {
                                htmlValue.Config["ContentsLangDirection"] = "rtl";
                            }

                            // Set the language
                            try
                            {
                                CultureInfo ci = new CultureInfo(DataHelper.GetNotEmpty(CMSContext.CurrentUser.PreferredUICultureCode, CMSContext.PreferredCultureCode));
                                htmlValue.DefaultLanguage = ci.TwoLetterISOLanguageName;
                            }
                            catch
                            {
                            }

                            htmlValue.AutoDetectLanguage = false;
                            htmlValue.Enabled = IsEnabled(ViewMode);

                            if (ViewMode == ViewModeEnum.EditDisabled)
                            {
                                pnlEditor.Controls.Add(new LiteralControl("<div style=\"width: 98%\">"));
                                pnlEditor.Controls.Add((Control)htmlValue);
                                pnlEditor.Controls.Add(new LiteralControl("</div>"));
                            }
                            else
                            {
                                pnlEditor.Controls.Add((Control)htmlValue);
                            }
                            break;

                        case CMSEditableRegionTypeEnum.TextArea:
                        case CMSEditableRegionTypeEnum.TextBox:
                            // TextBox
                            txtValue = new TextBox();
                            txtValue.ID = "txtValue";
                            txtValue.CssClass = "EditableTextTextBox";

                            txtValue.Enabled = IsEnabled(ViewMode);
                            pnlEditor.Controls.Add(txtValue);
                            break;
                    }
                    break;

                default:
                    // Display content in non editing modes
                    ltlContent = new Literal();
                    ltlContent.ID = "ltlContent";
                    ltlContent.EnableViewState = false;
                    Controls.Add(ltlContent);
                    break;
            }
        }
    }
예제 #35
0
        /// <summary>
        /// The	Page_Load event	on this	Page is	used to	obtain the ModuleID
        /// and	ItemID of the event	to edit.
        /// It then	uses the Appleseed.EventsDB()	data component
        /// to populate	the	page's edit	controls with the event	details.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Added EsperantusKeys for Localization
            // Mario Endara [email protected] 11/05/2004

            foreach (ListItem item in AllDay.Items)
            {
                switch (AllDay.Items.IndexOf(item))
                {
                    case 0:
                        item.Text = General.GetString("EVENTS_ALLDAY");
                        break;
                    case 1:
                        item.Text = General.GetString("EVENTS_STARTAT");
                        break;
                }
            }

            //Change Indah Fuldner [email protected]
            HtmlEditorDataType h = new HtmlEditorDataType();
            h.Value = this.ModuleSettings["Editor"].ToString();
            DescriptionField =
                h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(this.ModuleSettings["ShowUpload"].ToString()),
                            this.PortalSettings);

            DescriptionField.Width = new Unit(this.ModuleSettings["Width"].ToString());
            DescriptionField.Height = new Unit(this.ModuleSettings["Height"].ToString());
            //End Change Indah Fuldner [email protected]

            // If the page is being	requested the first	time, determine	if an
            // event itemID	value is specified,	and	if so populate page
            // contents	with the event details

            if (Page.IsPostBack == false)
            {
                if (ItemID != 0)
                {
                    // Obtain a	single row of event	information
                    EventsDB events = new EventsDB();
                    SqlDataReader dr = events.GetSingleEvent(ItemID, WorkFlowVersion.Staging);

                    try
                    {
                        // Read	first row from database
                        if (dr.Read())
                        {
                            TitleField.Text = (string) dr["Title"];
                            DescriptionField.Text = (string) dr["Description"];

                            // devsolution 2003/6/17: Added items for calendar control
                            if ((bool) dr["AllDay"])
                            {
                                AllDay.SelectedIndex = 0;
                            }
                            else
                            {
                                int hour = 0;
                                int minute = 0;

                                AllDay.SelectedIndex = 1;
                                StartHour.Enabled = StartMinute.Enabled = StartAMPM.Enabled = true;

                                string[] TimeParts = dr["StartTime"].ToString().Split(new Char[] {':'});

                                try
                                {
                                    if (TimeParts[0].Length > 0) hour = int.Parse(TimeParts[0]);
                                    if (TimeParts.Length > 1) minute = int.Parse(TimeParts[1]);
                                }
                                catch
                                {
                                }

                                if (hour > 11)
                                {
                                    StartAMPM.SelectedIndex = 1;
                                    if (hour > 12) hour -= 12;
                                }
                                else
                                {
                                    if (hour == 0) hour = 12;
                                    StartAMPM.SelectedIndex = 0;
                                }

                                StartHour.SelectedIndex = hour - 1;
                                StartMinute.SelectedIndex = minute/5;
                            }
                            if (dr["StartDate"] != DBNull.Value)
                                StartDate.Text = ((DateTime) dr["StartDate"]).ToShortDateString();
                            else
                                StartDate.Text = string.Empty;
                            // devsolution 2003/6/17: Finished - Added items for calendar control

                            ExpireField.Text = ((DateTime) dr["ExpireDate"]).ToShortDateString();
                            CreatedBy.Text = (string) dr["CreatedByUser"];
                            WhereWhenField.Text = (string) dr["WhereWhen"];
                            CreatedDate.Text = ((DateTime) dr["CreatedDate"]).ToShortDateString();
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (CreatedBy.Text == "unknown")
                            {
                                CreatedBy.Text = General.GetString("UNKNOWN", "unknown");
                            }
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }
                }
                else
                {
                    ExpireField.Text =
                        DateTime.Now.AddDays(Int32.Parse(this.ModuleSettings["DelayExpire"].ToString())).ToShortDateString();
                    this.DeleteButton.Visible = false; // Cannot	delete an unexsistent item
                }
            }
        }
예제 #36
0
 public static void InsertTable(IHtmlEditor htmlEditor, TableCreationParameters parameters)
 {
     InsertTable(htmlEditor, null, parameters);
 }
예제 #37
0
    /// <summary>
    /// Overriden CreateChildControls method.
    /// </summary>
    protected override void CreateChildControls()
    {
        SetupControl();

        this.Controls.Clear();
        base.CreateChildControls();

        if (!this.StopProcessing)
        {
            // Initialize viewmode
            viewMode = this.PageManager.ViewMode;

            // Create controls by actual page mode
            switch (viewMode)
            {
                case ViewModeEnum.Edit:
                case ViewModeEnum.EditDisabled:

                    // Main editor panel
                    this.pnlEditor = new Panel();
                    this.pnlEditor.ID = "pnlEditor";
                    this.pnlEditor.CssClass = "EditableTextEdit EditableText_" + this.ID;
                    this.Controls.Add(pnlEditor);

                    // Title label
                    this.lblTitle = new Label();
                    this.lblTitle.EnableViewState = false;
                    this.lblTitle.CssClass = "EditableTextTitle";
                    this.pnlEditor.Controls.Add(this.lblTitle);

                    // Error label
                    this.lblError = new Label();
                    this.lblError.EnableViewState = false;
                    this.lblError.CssClass = "EditableTextError";
                    this.pnlEditor.Controls.Add(this.lblError);

                    // Display the region control based on the region type
                    switch (this.RegionType)
                    {
                        case CMSEditableRegionTypeEnum.HtmlEditor:
                            // HTML Editor
                            this.htmlValue = new CMSHtmlEditor();
                            this.htmlValue.IsLiveSite = false;
                            this.htmlValue.ID = "htmlValue";
                            this.htmlValue.AutoDetectLanguage = false;
                            this.htmlValue.DefaultLanguage = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;

                            // Set direction
                            this.htmlValue.Config["ContentsLangDirection"] = "ltr";

                            if (CultureHelper.IsPreferredCultureRTL())
                            {
                                this.htmlValue.Config["ContentsLangDirection"] = "rtl";
                            }

                            // Set the language
                            try
                            {
                                System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(DataHelper.GetNotEmpty(CMSContext.CurrentUser.PreferredUICultureCode, CMSContext.PreferredCultureCode));
                                this.htmlValue.DefaultLanguage = ci.TwoLetterISOLanguageName;
                            }
                            catch
                            {
                            }

                            this.htmlValue.AutoDetectLanguage = false;
                            this.htmlValue.Enabled = (viewMode == ViewModeEnum.Edit);

                            if (viewMode == ViewModeEnum.EditDisabled)
                            {
                                this.pnlEditor.Controls.Add(new LiteralControl("<div style=\"width: 98%\">"));
                                this.pnlEditor.Controls.Add((Control)this.htmlValue);
                                this.pnlEditor.Controls.Add(new LiteralControl("</div>"));
                            }
                            else
                            {
                                this.pnlEditor.Controls.Add((Control)this.htmlValue);
                            }
                            break;

                        case CMSEditableRegionTypeEnum.TextArea:
                        case CMSEditableRegionTypeEnum.TextBox:
                            // TextBox
                            this.txtValue = new TextBox();
                            this.txtValue.ID = "txtValue";
                            this.txtValue.CssClass = "EditableTextTextBox";

                            this.txtValue.Enabled = (viewMode == ViewModeEnum.Edit);
                            this.pnlEditor.Controls.Add(this.txtValue);
                            break;
                    }
                    break;

                default:
                    // Display content in non editing modes
                    this.ltlContent = new Literal();
                    this.ltlContent.ID = "ltlContent";
                    this.ltlContent.EnableViewState = false;
                    this.Controls.Add(this.ltlContent);
                    break;
            }
        }
    }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            HtmlEditorDataType h = new HtmlEditorDataType();
            h.Value = this.ModuleSettings["Editor"].ToString();
            DesktopText =
                h.GetEditor(PlaceHolderHTMLEditor, ModuleID, bool.Parse(this.ModuleSettings["ShowUpload"].ToString()),
                            this.PortalSettings);
            DesktopText.Width = new Unit(this.ModuleSettings["Width"].ToString());
            DesktopText.Height = new Unit(this.ModuleSettings["Height"].ToString());

            if (!Page.IsPostBack)
            {
                if (bool.Parse(this.ModuleSettings["ENHANCEDHTML_GET_CONTENTS_FROM_PORTALS"].ToString()))
                {
                    kindOfContent.Items.Add(new ListItem("External Module", "Portal"));
                    CustomListDataType cldtAll =
                        new CustomListDataType(new ModulesDB().GetModulesAllPortals(), "ModuleTitle", "ModuleID");
                    listAllModules.CssClass = "NormalTextBox";
                    listAllModules.DataSource = cldtAll.DataSource;
                    listAllModules.DataValueField = cldtAll.DataValueField;
                    listAllModules.DataTextField = cldtAll.DataTextField;
                    listAllModules.DataBind();
                }
                CustomListDataType cldt =
                    new CustomListDataType(new ModulesDB().GetModulesSinglePortal(this.PortalSettings.PortalID),
                                           "ModuleTitle", "ModuleID");
                listModules.CssClass = "NormalTextBox";
                listModules.DataSource = cldt.DataSource;
                listModules.DataValueField = cldt.DataValueField;
                listModules.DataTextField = cldt.DataTextField;
                listModules.DataBind();

                string comando =
                    General.GetString("ENHANCEDHTML_CONFIRMDELETEMESSAGE", "Are You Sure You Wish To Delete This Item ?");
                cmdDeletePage.Attributes.Add("onClick", "javascript:return confirm('" + comando + "');");
                ViewState["UrlReferrer"] = HttpUrlBuilder.BuildUrl(PageID);

                CultureInfo[] listaLang = LanguageSwitcher.GetLanguageList(true);

                lstLanguages.Items.Add(new ListItem(General.GetString("ENHANCEDHTML_SHOWALLPAGES", "All Pages"), "0"));
                foreach (CultureInfo ci in listaLang)
                {
                    lstLanguages.Items.Add(new ListItem(ci.DisplayName, (ci.LCID).ToString()));
                    listLanguages.Items.Add(new ListItem(ci.DisplayName, (ci.LCID).ToString()));
                }
                lstLanguages.SelectedIndex = 0;
                listLanguages.SelectedIndex = 0;
                ShowList();
            }
        }
예제 #39
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">
        /// An <see cref="T:System.EventArgs"/> object that contains the event data.
        /// </param>
        protected override void OnInit(EventArgs e)
        {
            this.To = new EmailAddressList();
            this.Cc = new EmailAddressList();
            this.Bcc = new EmailAddressList();

            var h = new HtmlEditorDataType();
            var pS = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
            try
            {
                h.Value = pS.CustomSettings["SITESETTINGS_DEFAULT_EDITOR"].ToString();
                this.txtBody = h.GetEditor(
                    this.PlaceHolderHTMLEditor,
                    int.Parse(this.Context.Request["mID"]),
                    bool.Parse(pS.CustomSettings["SITESETTINGS_SHOWUPLOAD"].ToString()),
                    pS);
            }
            catch
            {
                this.txtBody = h.GetEditor(this.PlaceHolderHTMLEditor, int.Parse(this.Context.Request["mID"]), true, pS);
            }

            this.lblEmailAddressesNotOk.Text = General.GetString(
                "EMF_ADDRESSES_NOT_OK", "The emailaddresses are not ok.", this.lblEmailAddressesNotOk);

            this.txtTo.Text = string.Join(";", (string[])this.To.ToArray(typeof(string)));
            this.txtCc.Text = string.Join(";", (string[])this.Cc.ToArray(typeof(string)));
            this.txtBcc.Text = string.Join(";", (string[])this.Bcc.ToArray(typeof(string)));

            base.OnInit(e);
        }