Ejemplo n.º 1
0
        /// <summary>
        /// Check first field of a note is empty or dupe with other or not
        /// </summary>
        /// <returns></returns>
        public FirstField DupeOrEmpty()
        {
            string text = HtmlEditor.RemoveDivWrap(fields[0]).Trim();

            if (text.Length == 0)
            {
                return(FirstField.Empty);
            }
            long csum     = Utils.FieldChecksum(text);
            var  listNote = collection.Database.QueryColumn <NoteTable>
                                ("SELECT flds, id FROM notes WHERE csum = "
                                + csum + " AND id != " + (id != 0 ? id : 0) + " AND mid = " + modelId);

            // find any matching csums and compare
            foreach (var note in listNote)
            {
                string compared = HtmlEditor.RemoveDivWrap(Utils.SplitFields(note.Fields)[0]).Trim();
                if (Utils.StripHTMLKeepMediaName(compared)
                    .Equals(Utils.StripHTMLKeepMediaName(text)))
                {
                    DupeNoteId = note.Id;
                    return(FirstField.Duplicate);
                }
            }
            return(FirstField.Valid);
        }
Ejemplo n.º 2
0
        internal string DrawHtml(string uniqueID, WebGridHtmlWriter writer, Grid grid, RowCell cell)
        {
            string theValueToShow = Value(cell);

            HtmlEditor e = new HtmlEditor
            {
                ID        = uniqueID,
                ImagePath = Grid.ImagePath,
                UserBRonCarriageReturn = true,
                Width  = (WidthEditableColumn != Unit.Empty ? WidthEditableColumn : 500),
                Height = (HeightEditableColumn != Unit.Empty ? HeightEditableColumn : 400),
                Text   = theValueToShow
            };

            e.ImagePath = GridConfig.Get("WGEditorImagePath", grid.ImagePath);
            StringBuilder sb = new StringBuilder();
            StringWriter  sw = new StringWriter(sb);

            System.Web.UI.HtmlTextWriter mywriter = new System.Web.UI.HtmlTextWriter(sw);
            e.RenderControl(mywriter);
            mywriter.Flush();
            mywriter.Close();

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        void InitializeComponent()
        {
            htmlEditor          = new HtmlEditor();
            htmlEditor.ReadOnly = ReadOnly;

            btnEdit        = new Button();
            btnEdit.Text   = "Edit";
            btnEdit.Click += btnEdit_Click;

            btnSave        = new Button();
            btnSave.Text   = "Accept Changes";
            btnSave.Width  = 120;
            btnSave.Click += btnAcceptChanges_Click;

            btnCancelEdit        = new Button();
            btnCancelEdit.Text   = "Cancel";
            btnCancelEdit.Click += btnCancelEdit_Click;

            btnClose        = new Button();
            btnClose.Text   = "Close";
            btnClose.Click += btnClose_Click;

            SuspendLayout();
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
            CancelButton    = btnClose;
            Controls.AddRange(new Control[] { htmlEditor, btnEdit, btnSave, btnCancelEdit, btnClose });
            MinimumSize = new Size(400, 300);
            if (Options.Current.Contains(RemarkDialogSize))
            {
                Size = Options.Current.GetValue(RemarkDialogSize, Size);
            }
            ResumeLayout(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            var editor = new HtmlEditor {
                ID = id
            };

            if (configurationValues != null &&
                configurationValues.ContainsKey(TOOLBAR) &&
                configurationValues[TOOLBAR].Value == "Full")
            {
                editor.Toolbar = HtmlEditor.ToolbarConfig.Full;
            }
            else
            {
                editor.Toolbar = HtmlEditor.ToolbarConfig.Light;
            }

            if (configurationValues != null && configurationValues.ContainsKey(DOCUMENT_FOLDER_ROOT))
            {
                editor.DocumentFolderRoot = configurationValues[DOCUMENT_FOLDER_ROOT].Value;
            }

            if (configurationValues != null && configurationValues.ContainsKey(IMAGE_FOLDER_ROOT))
            {
                editor.ImageFolderRoot = configurationValues[IMAGE_FOLDER_ROOT].Value;
            }

            if (configurationValues != null && configurationValues.ContainsKey(USER_SPECIFIC_ROOT))
            {
                editor.UserSpecificRoot = configurationValues[USER_SPECIFIC_ROOT].Value.AsBoolean(false);
            }

            return(editor);
        }
        public void AddFirstFieldToList(Note note)
        {
            string    fieldName  = note.Model["flds"].GetArray().GetObjectAt(0).GetNamedString("name");;
            NoteField firstField = new NoteField(note.Id, fieldName, 0, HtmlEditor.RemoveDivWrap(note.Fields[0]).Trim());

            FirstFields.Insert(0, firstField);
        }
Ejemplo n.º 6
0
 public static void SetupDefaultButtons(HtmlEditor editor)
 {
     editor.AddToolbarItem(new BoldButton());
     editor.AddToolbarItem(new ItalicButton());
     editor.AddStyleSelector();
     editor.AddFontSizeSelector(Enumerable.Range(1, 7));
     editor.AddFontSelector(_webSafeFonts);
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new LinkButton());
     editor.AddToolbarItem(new UnlinkButton());
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new InsertLinkedImageButton());
     editor.AddToolbarItem(new InsertOnlineImageButton());
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new OrderedListButton());
     editor.AddToolbarItem(new UnorderedListButton());
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new ForecolorButton());
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new JustifyLeftButton());
     editor.AddToolbarItem(new JustifyCenterButton());
     editor.AddToolbarItem(new JustifyRightButton());
     editor.AddToolbarDivider();
     // editor.AddToolbarItem(new PrintButton());
     editor.AddToolbarItem(new ViewHtmlButton());
 }
Ejemplo n.º 7
0
 public static void SetupDefaultButtons(HtmlEditor editor)
 {
     editor.AddToolbarItem(new BoldButton());
     editor.AddToolbarItem(new ItalicButton());
     editor.AddToolbarItem(new UnderlineButton());
     editor.AddToolbarItem(new StrikeThroughButton());
     editor.AddStyleSelector();
     editor.AddFontSizeSelector(Enumerable.Range(1, 7));
     editor.AddFontSelector(_webSafeFonts);
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new LinkButton());
     editor.AddToolbarItem(new UnlinkButton());
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new InsertLinkedImageButton());
     editor.AddToolbarItem(new InsertOnlineImageButton());
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new OrderedListButton());
     editor.AddToolbarItem(new UnorderedListButton());
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new ForecolorButton());
     editor.AddToolbarDivider();
     editor.AddToolbarItem(new JustifyLeftButton());
     editor.AddToolbarItem(new JustifyCenterButton());
     editor.AddToolbarItem(new JustifyRightButton());
     editor.AddToolbarDivider();
     // editor.AddToolbarItem(new PrintButton());
     editor.AddToolbarItem(new ViewHtmlButton());
 }
Ejemplo n.º 8
0
        public TemplateView()
        {
            this.InitializeComponent();
            ZoomLevel = 1;

            if (UIHelper.IsHasPhysicalKeyboard())
            {
                HTML_PATH = "/html/templateeditor.html";
            }
            else
            {
                HTML_PATH = "/html/templateeditortouch.html";
            }

            string windowSize = WindowSizeStates.CurrentState.Name;

            menuFlyout = Resources["TemplateContextMenu"] as MenuFlyout;

            htmlEditor = new HtmlEditor(webViewGrid, contextMenuPlace, menuFlyout,
                                        windowSize, HTML_PATH, CoreWindow.GetForCurrentThread().Dispatcher);

            htmlEditor.WebviewButtonClickEvent       += HtmlEditorWebviewButtonClickEventHandler;
            htmlEditor.EditableFieldPasteEvent       += FieldPasteEventHandler;
            htmlEditor.FieldReadyToPopulateEvent     += PopulateTemplateField;
            htmlEditor.EditableFieldTextChangedEvent += EditableFieldTextChangedEventHandler;
            htmlEditor.FieldPopulateFinishEvent      += HtmlEditorFieldPopulateFinishEventHandler;
        }
Ejemplo n.º 9
0
        private void ButtonAddAttachment_Click(object sender, System.EventArgs e)
        {
            HtmlEditor.Focus();

            OpenFileDialogAttachment.Reset();
            OpenFileDialogAttachment.Multiselect     = true;
            OpenFileDialogAttachment.CheckFileExists = true;
            OpenFileDialogAttachment.CheckPathExists = true;

            if (OpenFileDialogAttachment.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string[] attachments = OpenFileDialogAttachment.FileNames;
            for (int i = 0; i < attachments.Length; i++)
            {
                _attachments.Add(attachments[i]);

                string fileName = attachments[i];
                int    pos      = fileName.LastIndexOf("\\");
                if (pos != -1)
                {
                    fileName = fileName.Substring(pos + 1);
                }

                TextBoxAttachments.Text += fileName;
                TextBoxAttachments.Text += ";";
            }
        }
    /// <summary>
    /// criando as imagens
    /// </summary>
    protected void CreateConstrainProportionsImages()
    {
        Image imgTop = RenderUtils.CreateImage();

        cellContarainTop.Controls.Add(imgTop);
        HtmlEditor.GetInsertImageDialogConstrainProportionsTop().AssignToControl(imgTop, false);

        Image imgBottom = RenderUtils.CreateImage();

        cellContarainBottom.Controls.Add(imgBottom);
        HtmlEditor.GetInsertImageDialogConstrainProportionsBottom().AssignToControl(imgBottom, false);

        Image imgSwitcherOn = RenderUtils.CreateImage();

        imgSwitcherOn.ID = "imgOn";
        cellContarainSwitcher.Controls.Add(imgSwitcherOn);
        HtmlEditor.GetInsertImageDialogConstrainProportionsMiddleOn().AssignToControl(imgSwitcherOn, false);

        Image imgSwitcherOff = RenderUtils.CreateImage();

        imgSwitcherOff.ID = "imgOff";
        cellContarainSwitcher.Controls.Add(imgSwitcherOff);
        HtmlEditor.GetInsertImageDialogConstrainProportionsMiddleOff().AssignToControl(imgSwitcherOff, false);

        imgSwitcherOn.Attributes.Add("onclick", "aspxConstrainProportionsSwitchClick(event, '" + imgSwitcherOff.ClientID + "')");
        imgSwitcherOff.Attributes.Add("onclick", "aspxConstrainProportionsSwitchClick(event,'" + imgSwitcherOn.ClientID + "')");
        imgSwitcherOff.Style.Add("display", "none");
    }
Ejemplo n.º 11
0
 private void _initHtmlEditor()
 {
     HtmlEditor.Navigate("about:blank");
     _htmlDoc            = HtmlEditor.Document.DomDocument as mshtml.IHTMLDocument2;
     _htmlDoc.designMode = "on";
     _initFonts();
 }
Ejemplo n.º 12
0
        /// <summary>
        /// If fields or tags have changed, write changes to disk.
        /// </summary>
        /// <param name="mod"></param>
        /// <param name="changeUsn"></param>
        public void SaveChangesToDatabase(long?mod = null, bool changeUsn = true)
        {
            Debug.Assert(scm == collection.Scm);
            PreFlush();
            if (changeUsn)
            {
                usn = collection.Usn;
            }
            string sfld   = Utils.StripHTMLKeepMediaName(this.fields[collection.Models.SortIdx(model)]);
            string tags   = StringTags();
            string fields = JoinedFields();

            if (mod == null && collection.Database.QueryScalar <int>
                    ("select 1 from notes where id = ? and tags = ? and flds = ?", this.id, tags, fields) > 0)
            {
                return;
            }
            //WARNING: In AnkiU we always include content into <div> block
            //so before checksum we have to remove and trim text first
            long csum = Utils.FieldChecksum(HtmlEditor.RemoveDivWrap(this.fields[0]).Trim());

            this.timeModified = (mod != null) ? (long)mod : DateTimeOffset.Now.ToUnixTimeSeconds();
            collection.Database.Execute("insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?)",
                                        new object[] { this.id, guId, this.modelId, this.timeModified, usn, tags, fields, sfld, csum, this.flags, this.data });
            collection.Tags.Register(this.tags);
            PostFlush();
        }
Ejemplo n.º 13
0
 void IDisposable.Dispose()
 {
     _namespaceTable       = null;
     _registeredNamespaces = null;
     _registeredBehaviors  = null;
     _editor = null;
 }
Ejemplo n.º 14
0
        public void SetupBeforeTest()
        {
            TestEditor = new HtmlEditor();

            TestStyleBar = new StyleBar();

            System.Diagnostics.Debug.WriteLine("Setting up test!");
        }
Ejemplo n.º 15
0
        private void ComboBoxFont_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string font = ComboBoxFont.Text;

            ComboBoxFont.SelectedIndex = 0;
            _htmlDoc.execCommand("fontname", false, font);
            HtmlEditor.Focus();
        }
Ejemplo n.º 16
0
        private void ComboBoxSize_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string size = ComboBoxSize.Text;

            ComboBoxSize.SelectedIndex = 0;
            _htmlDoc.execCommand("fontsize", false, size);
            HtmlEditor.Focus();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// This public interface receives the request and send the response of type byte array
        /// </summary>
        /// <returns></returns>
        public byte[] SendRequest(HtmlEditor Editor, int timeout)
        {
            byte[] FinalResponse = new byte[0];
            string Cookie        = "";

            NameValueCollection collHeader = new NameValueCollection();

            HttpWebResponse webresponse = null;
            HttpWebRequest  webrequest  = null;

            HttpBaseClass BaseHttp = new HttpBaseClass(UserName, UserPwd, proxyServer, proxyPort, ProxyCredentials, Request, Editor);

            try
            {
                webrequest             = BaseHttp.CreateWebRequest(null, URI, collHeader, RequestMethod, true);
                webrequest.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.CacheIfAvailable);
                webrequest.UserAgent   = UserAgent;
                webrequest.Timeout     = timeout;
                webresponse            = (HttpWebResponse)webrequest.GetResponse();

                string ReUri = BaseHttp.GetRedirectURL(webresponse, ref Cookie);
                //Check if there is any redirected URI.
                //webresponse.Close();
                ReUri = ReUri.Trim();
                if (ReUri.Length == 0) //No redirection URI
                {
                    ReUri = URI;
                }

                Encoding enc = Encoding.Default;
                System.IO.StreamReader loResponseStream = new System.IO.StreamReader(webresponse.GetResponseStream(), enc);

                string Response = loResponseStream.ReadToEnd();

                loResponseStream.Close();
                webresponse.Close();

                return(enc.GetBytes(Response));


                //FinalResponse = BaseHttp.GetFinalResponse(ReUri, Cookie, RequestMethod, true, timeOut);
            }//End of Try Block

            catch (WebException e)
            {
                InvokeWebError(webrequest, e);
            }
            catch (System.Exception e)
            {
                throw e;
            }
            finally
            {
                BaseHttp = null;
            }
            return(FinalResponse);
        } //End of SendRequestTo method
Ejemplo n.º 18
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);
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Creates the control(s) neccessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            var editor = new HtmlEditor {
                ID = id
            };

            editor.Toolbar = HtmlEditor.ToolbarConfig.Light;
            return(editor);
        }
Ejemplo n.º 20
0
 /// <summary>
 /// </summary>
 public MSHTMLSite(HtmlEditor htmlEditor)
 {
     if ((htmlEditor == null))// || (htmlEditor.IsHandleCreated == false))
     {
         throw new ArgumentException();
     }
     WithUI                 = false;
     this.htmlEditor        = htmlEditor;
     this._readyStateString = String.Empty;
 }
Ejemplo n.º 21
0
 private void ButtonColor_Click(object sender, System.EventArgs e)
 {
     if (ColorDialogForeColor.ShowDialog() == DialogResult.OK)
     {
         string v = string.Format("#{0:x2}{1:x2}{2:x2}", ColorDialogForeColor.Color.R,
                                  ColorDialogForeColor.Color.G,
                                  ColorDialogForeColor.Color.B);
         _htmlDoc.execCommand("ForeColor", false, v);
     }
     HtmlEditor.Focus();
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Email" /> class.
 /// </summary>
 public Email()
 {
     tbFromName = new RockTextBox();
     tbFromAddress = new RockTextBox();
     tbReplyToAddress = new RockTextBox();
     tbSubject = new RockTextBox();
     htmlMessage = new HtmlEditor();
     tbTextMessage = new RockTextBox();
     hfAttachments = new HiddenField();
     fuAttachments = new FileUploader();
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Email" /> class.
 /// </summary>
 public Email()
 {
     tbFromName       = new RockTextBox();
     tbFromAddress    = new RockTextBox();
     tbReplyToAddress = new RockTextBox();
     tbSubject        = new RockTextBox();
     htmlMessage      = new HtmlEditor();
     tbTextMessage    = new RockTextBox();
     hfAttachments    = new HiddenField();
     fuAttachments    = new FileUploader();
 }
Ejemplo n.º 24
0
        private void Bind()
        {
            FineUI.TextBox    tbx   = FormPanel.FindControl("txtInput") as FineUI.TextBox;
            FineUI.FileUpload fu1   = FormPanel.FindControl("up1") as FineUI.FileUpload;
            FineUI.FileUpload fu2   = FormPanel.FindControl("up2") as FineUI.FileUpload;
            HtmlEditor        html1 = FormPanel.FindControl("he1") as HtmlEditor;

            if (ViewState["type"].ToString() == "1")
            {
            }
        }
Ejemplo n.º 25
0
        private async void InsertLink_Click(object sender, RoutedEventArgs e)
        {
            string cmd = string.Format(
                "document.execCommand(\"CreateLink\", false, \"{0}\");", TextLink.Text);

            await HtmlEditor.InvokeScriptAsync("restoreSelection", null);

            await HtmlEditor.InvokeScriptAsync("eval",
                                               new string[] { cmd });

            FlyoutLink.Hide();
            HtmlEditor.Focus(FocusState.Programmatic);
        }
Ejemplo n.º 26
0
        private async void Align_Click(object sender, RoutedEventArgs e)
        {
            MenuFlyoutItem item = sender as MenuFlyoutItem;
            string         cmd  = string.Format(
                "document.execCommand(\"Justify{0}\", false, \"\");", item.Text);

            await HtmlEditor.InvokeScriptAsync("restoreSelection", null);

            await HtmlEditor.InvokeScriptAsync("eval",
                                               new string[] { cmd });

            HtmlEditor.Focus(FocusState.Programmatic);
        }
Ejemplo n.º 27
0
        internal ChangeMonitor(Interop.IMarkupContainer2 mc, HtmlEditor editor)
        {
            this.editor = editor;
            this.mc2    = mc;

            sink = new ChangeSink();

            this.RegisterDirtyRange();

            if (cookie != 0)
            {
                sink.Change += new EventHandler(sink_Change);
            }
        }
Ejemplo n.º 28
0
        protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
        {
            base.InitializeDataCell(cell, rowState);
            HtmlEditor control = GetFieldControl(cell);

            if (base.Visible && control != null)
            {
                if (!String.IsNullOrEmpty(ToolsFile))
                {
                    control.ToolsFile = ToolsFile;
                }
                control.EditModes = EditModes;
            }
        }
Ejemplo n.º 29
0
        private async void HtmlEditor_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            string cmd = "document.designMode = \"On\";"
                         + "document.contentEditable = true;"
                         + "document.body.innerHTML =\"<div>&nbsp;</div>\";"
                         + "document.body.style.fontFamily = \"Calibri\";"
                         + "document.body.style.fontSize = \"15pt\";"
                         + "document.charset = \"utf-8\";";

            await HtmlEditor.InvokeScriptAsync("eval",
                                               new string[] { cmd });

            await HtmlEditor.InvokeScriptAsync("setText", new string[] { TextEditor.Text });
        }
Ejemplo n.º 30
0
        void InitializeComponent()
        {
            htmlEditor          = new HtmlEditor();
            htmlEditor.ReadOnly = ReadOnly;

            SuspendLayout();
            Controls.Add(htmlEditor);
            MinimumSize = new Size(400, 300);
            if (Options.Current.Contains(NoteWidgetDialogSize))
            {
                Size = Options.Current.GetValue(NoteWidgetDialogSize, Size);
            }
            ResumeLayout(false);
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Creates a new instance of the HTTP loader class.
 /// </summary>
 /// <param name="HttpUserName">User name, required only if authentication is necessary.</param>
 /// <param name="HttpUserPwd">Password, required only if authentication is necessary.</param>
 /// <param name="HttpProxyServer">Proxy server, optional. Provide empty string if none is required.</param>
 /// <param name="HttpProxyPort">Port the proxy is listening to.</param>
 /// <param name="HttpRequest">Current request data.</param>
 /// <param name="proxyCredentials"></param>
 /// <param name="editor">Editor the HTTP loader belongs to.</param>
 public HttpBaseClass(string HttpUserName, string HttpUserPwd, string HttpProxyServer, int HttpProxyPort, ICredentials proxyCredentials, string HttpRequest, HtmlEditor editor)
 {
     this.UserName         = HttpUserName;
     this.UserPwd          = HttpUserPwd;
     this.ProxyServer      = HttpProxyServer;
     this.ProxyPort        = HttpProxyPort;
     this.proxyCredentials = proxyCredentials;
     if (proxyCredentials is NetworkCredential)
     {
         this.ProxyUserPwd  = ((NetworkCredential)proxyCredentials).Password;
         this.ProxyUserName = ((NetworkCredential)proxyCredentials).UserName;
     }
     this.Request = HttpRequest;
     this.editor  = editor;
 }
Ejemplo n.º 32
0
        private async void ColorMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuFlyoutItem item = sender as MenuFlyoutItem;

            string color = item.DataContext as string;
            string cmd   = string.Format(
                "document.execCommand(\"ForeColor\", false, \"{0}\");", color);

            await HtmlEditor.InvokeScriptAsync("restoreSelection", null);

            await HtmlEditor.InvokeScriptAsync("eval",
                                               new string[] { cmd });

            HtmlEditor.Focus(FocusState.Programmatic);
        }
Ejemplo n.º 33
0
        protected override void CreateChildControls()
        {
            this.Controls.Clear();

            PartPropertyValue = new HtmlEditor();
            PartPropertyValue.Height = new Unit(400, UnitType.Pixel);
            PartPropertyValue.Width = new Unit(100, UnitType.Percentage);

            PartPropertyValue.Plugins = "safari,style,layer,table,save,advhr,advimage,advlink,inlinepopups,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,xhtmlxtras";
            PartPropertyValue.ThemeAdvancedButtons1 = "fullscreen,code,|,cut,copy,paste,|,undo,redo,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,|,formatselect,fontselect,fontsizeselect";
            PartPropertyValue.ThemeAdvancedButtons2 = "search,replace,|,link,unlink,anchor,image,|,forecolor,backcolor,|,tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,advhr,|,styleprops";
            PartPropertyValue.ThemeAdvancedButtons3 = "";
            PartPropertyValue.ThemeAdvancedButtons4 = "";
            PartPropertyValue.ThemeAdvancedResizing = false;
            PartPropertyValue.Language = "es";

            this.Controls.Add(PartPropertyValue);
        }
Ejemplo n.º 34
0
 public HtmlSelection(HtmlEditor editor)
 {
     _editor = editor;
     _minZIndex = 100;
     _maxZIndex = 99;
 }
Ejemplo n.º 35
0
        internal string DrawHtml(string uniqueID, WebGridHtmlWriter writer, Grid grid,RowCell cell)
        {
            string theValueToShow = Value(cell);

            HtmlEditor e = new HtmlEditor
                               {
                                   ID = uniqueID,
                                   ImagePath = Grid.ImagePath,
                                   UserBRonCarriageReturn = true,
                                   Width = (WidthEditableColumn != Unit.Empty ? WidthEditableColumn : 500),
                                   Height = (HeightEditableColumn != Unit.Empty ? HeightEditableColumn : 400),
                                   Text = theValueToShow
                               };

            e.ImagePath = GridConfig.Get("WGEditorImagePath", grid.ImagePath);
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            System.Web.UI.HtmlTextWriter mywriter = new System.Web.UI.HtmlTextWriter(sw);
            e.RenderControl(mywriter);
            mywriter.Flush();
            mywriter.Close();

            return sb.ToString();
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Controls.Clear();

            tbFromName = new RockTextBox();
            tbFromName.ID = string.Format( "tbFromName_{0}", this.ID );
            tbFromName.Label = "From Name";
            Controls.Add( tbFromName );

            lFromName = new RockLiteral();
            lFromName.ID = string.Format( "lFromName_{0}", this.ID );
            lFromName.Label = "From Name";
            Controls.Add( lFromName );

            ebFromAddress = new EmailBox();
            ebFromAddress.ID = string.Format( "ebFromAddress_{0}", this.ID );
            ebFromAddress.Label = "From Address";
            Controls.Add( ebFromAddress );

            lFromAddress = new RockLiteral();
            lFromAddress.ID = string.Format( "lFromAddress_{0}", this.ID );
            lFromAddress.Label = "From Address";
            Controls.Add( lFromAddress );

            ebReplyToAddress = new EmailBox();
            ebReplyToAddress.ID = string.Format( "ebReplyToAddress_{0}", this.ID );
            ebReplyToAddress.Label = "Reply To Address";
            Controls.Add( ebReplyToAddress );

            tbSubject = new RockTextBox();
            tbSubject.ID = string.Format( "tbSubject_{0}", this.ID );
            tbSubject.Label = "Subject";
            tbSubject.Help = "<span class='tip tip-lava'></span>";
            Controls.Add( tbSubject );

            htmlMessage = new HtmlEditor();
            htmlMessage.ID = string.Format( "htmlMessage_{0}", this.ID );
            //htmlMessage.AdditionalConfigurations = "autoParagraph: false,";
            htmlMessage.Help = "<span class='tip tip-lava'></span> <span class='tip tip-html'>";
            this.AdditionalMergeFields.ForEach( m => htmlMessage.MergeFields.Add( m ) );
            htmlMessage.Label = "Message";
            htmlMessage.Height = 600;
            Controls.Add( htmlMessage );

            tbTextMessage = new RockTextBox();
            tbTextMessage.ID = string.Format( "tbTextMessage_{0}", this.ID );
            tbTextMessage.Label = "Message (Text Version)";
            tbTextMessage.TextMode = TextBoxMode.MultiLine;
            tbTextMessage.Rows = 5;
            tbTextMessage.CssClass = "span12";
            Controls.Add( tbTextMessage );

            hfAttachments = new HiddenField();
            hfAttachments.ID = string.Format( "hfAttachments_{0}", this.ID );
            Controls.Add( hfAttachments );

            fuAttachments = new FileUploader();
            fuAttachments.ID = string.Format( "fuAttachments_{0}", this.ID );
            fuAttachments.Label = "Attachments";
            fuAttachments.FileUploaded += fuAttachments_FileUploaded;
            Controls.Add( fuAttachments );
        }
Ejemplo n.º 37
0
        private void BuildFormPanel()
        {
            this.cbxReminder = new Checkbox  {
                Ref = "../../../hasReminder",
                BoxLabel = "Reminder:",
                DataIndex = "HasReminder",
                Checked = false
            };

            this.dfReminder = new DateField
            {
                Ref = "../../../reminder",
                Disabled = true,
                DataIndex = "Reminder",
                Width = 135
            };

            this.taskSubject = new TextField
            {
                AllowBlank = false,
                FieldLabel = "Task&nbsp;Subject",
                DataIndex = "Title",
                Anchor = "100%"
            };

            this.dueDate = new DateField
            {
                AllowBlank = false,
                FieldLabel = "Due Date",
                DataIndex = "DueDate",
                Width = 135
            };

            this.taskCategory = new DropDownField
              {
                  AllowBlank = false,
                  LazyInit = false,
                  FieldLabel = "Task List",
                  DataIndex = "Name",
                  Editable = false,
                  Mode = DropDownMode.ValueText,
                  Ref = "../../../taskCategory",
                  Component =
                  {
                      new TreePanel
                      {
                          Height = 150,
                          Shadow = ShadowMode.None,
                          UseArrows = true,
                          AutoScroll = true,
                          Animate = true,
                          RootVisible = false,
                          Cls = "tasks-tree",
                          Root =
                          {
                              new TreeNode("root")
                          },
                          SelectionModel =
                          {
                              new DefaultSelectionModel()
                          }
                      }
                  }
              };

            this.description = new HtmlEditor
            {
                HideLabel = true,
                DataIndex = "Description",
                Anchor = "100% -150",
                EnableSourceEdit = false,
                EnableFont = false
            };

            this.formPanel = new FormPanel
             {
                 Region = Ext.Net.Region.Center,
                 LabelWidth = 75,
                 ButtonAlign = Alignment.Right,
                 MinButtonWidth = 80,
                 BaseCls = "x-plain",
                 Ref = "taskForm",
                 Cls = "task-window", RenderFormElement = false,

                 CustomConfig =
                 {
                     new ConfigItem("margins", "10 10 5 10", ParameterMode.Value)
                 },

                 Items =
                 {
                     new BoxComponent
                     {
                         Hidden = true,
                         Ref = "../taskMessage",
                         AutoEl =
                         {
                             Cls = "taskMessage"
                         }
                     },
                     taskSubject,
                     new Container
                     {
                         Cls = "x-plain",
                         Layout = "Hbox",
                         Anchor = "100%",
                         Height = 30,
                         Items =
                         {
                             new Container
                             {
                                 Width = 250,
                                 Layout = "Form",
                                 Cls = "x-pain",
                                 Items =
                                 {
                                     dueDate
                                 }
                             },
                             new Container
                             {
                                 Flex = 1,
                                 Layout = "Form",
                                 Cls = "x-plain",
                                 LabelWidth = 55,
                                 Items =
                                 {
                                     taskCategory
                                 }
                             }
                         }
                     },
                     new BoxComponent
                     {
                         AutoEl =
                         {
                             Cls = "divider"
                         }
                     },
                     new Container
                     {
                         Layout = "HBox",
                         Anchor = "100%",
                         Cls = "x-plain",
                         Height = 30,
                         Items =
                         {
                             new Container
                             {
                                 Width = 80,
                                 Layout = "Form",
                                 Cls = "x-plain",
                                 HideLabels = true,
                                 Items =
                                 {
                                     cbxReminder
                                 }
                             },
                             new Container
                             {
                                 Flex = 1,
                                 Layout = "Form",
                                 Cls = "x-plain",
                                 HideLabels = true,
                                 Items =
                                 {
                                     dfReminder
                                 }
                             }
                         }
                     },
                     description
                 }
             };

            this.Buttons.Add(new Button ("OK"));
            this.Buttons.Add(new Button ("Cancel"));

            this.Items.Add(this.formPanel);
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            Controls.Clear();

            tbFromName = new RockTextBox();
            tbFromName.ID = string.Format( "tbFromName_{0}", this.ID );
            tbFromName.Label = "From Name";
            Controls.Add( tbFromName );

            tbFromAddress = new RockTextBox();
            tbFromAddress.ID = string.Format( "tbFromAddress_{0}", this.ID );
            tbFromAddress.Label = "From Address";
            Controls.Add( tbFromAddress );

            tbReplyToAddress = new RockTextBox();
            tbReplyToAddress.ID = string.Format( "tbReplyToAddress_{0}", this.ID );
            tbReplyToAddress.Label = "Reply To Address";
            Controls.Add( tbReplyToAddress );

            tbSubject = new RockTextBox();
            tbSubject.ID = string.Format( "tbSubject_{0}", this.ID );
            tbSubject.Label = "Subject";
            Controls.Add( tbSubject );

            htmlMessage = new HtmlEditor();
            htmlMessage.ID = string.Format( "htmlMessage_{0}", this.ID );
            htmlMessage.AdditionalConfigurations = "autoParagraph: false,";
            htmlMessage.MergeFields.Clear();
            htmlMessage.MergeFields.Add( "GlobalAttribute" );
            htmlMessage.MergeFields.Add( "Rock.Model.Person" );
            htmlMessage.MergeFields.Add( "UnsubscribeOption" );
            this.AdditionalMergeFields.ForEach( m => htmlMessage.MergeFields.Add( m ) );
            htmlMessage.Label = "Message";
            htmlMessage.Height = 600;
            Controls.Add( htmlMessage );

            tbTextMessage = new RockTextBox();
            tbTextMessage.ID = string.Format( "tbTextMessage_{0}", this.ID );
            tbTextMessage.Label = "Message (Text Version)";
            tbTextMessage.TextMode = TextBoxMode.MultiLine;
            tbTextMessage.Rows = 5;
            tbTextMessage.CssClass = "span12";
            Controls.Add( tbTextMessage );

            hfAttachments = new HiddenField();
            hfAttachments.ID = string.Format( "hfAttachments_{0}", this.ID );
            Controls.Add( hfAttachments );

            fuAttachments = new FileUploader();
            fuAttachments.ID = string.Format( "fuAttachments_{0}", this.ID );
            fuAttachments.Label = "Attachments";
            fuAttachments.FileUploaded += fuAttachments_FileUploaded;
            Controls.Add( fuAttachments );
        }