Esempio n. 1
0
        private void initButtons()
        {
            if (!_isInitialized)
            {
                _isInitialized = true;

                // Add icons for the editor control:
                // Html
                // Preview
                // Style picker, showstyles
                // Bold, italic, Text Gen
                // Align: left, center, right
                // Lists: Bullet, Ordered, indent, undo indent
                // Link, Anchor
                // Insert: Image, macro, table, formular

                foreach (string button in _activateButtons.Split(','))
                {
                    if (button.Trim() != "")
                    {
                        try
                        {
                            var cmd = (tinyMCECommand)tinyMCEConfiguration.Commands[button];

                            string appendValue = "";
                            if (cmd.Value != "")
                                appendValue = ", '" + cmd.Value + "'";
                            _mceButtons.Add(cmd.Priority, cmd.Command);
                            _buttons.Add(cmd.Priority,
                                         new editorButton(cmd.Alias, ui.Text("buttons", cmd.Alias, null), cmd.Icon,
                                                          "tinyMCE.execInstanceCommand('" + ClientID + "', '" +
                                                          cmd.Command + "', " + cmd.UserInterface + appendValue + ")"));
                        }
                        catch (Exception ee)
                        {
							LogHelper.Error<TinyMCE>(string.Format("TinyMCE: Error initializing button '{0}'", button), ee);
                        }
                    }
                }

                // add save icon
                int separatorPriority = 0;
                IDictionaryEnumerator ide = _buttons.GetEnumerator();
                while (ide.MoveNext())
                {
                    object buttonObj = ide.Value;
                    var curPriority = (int)ide.Key;

                    // Check priority
                    if (separatorPriority > 0 &&
                        Math.Floor(decimal.Parse(curPriority.ToString()) / 10) >
                        Math.Floor(decimal.Parse(separatorPriority.ToString()) / 10))
                        _menuIcons.Add("|");

                    try
                    {
                        var e = (editorButton)buttonObj;

                        MenuIconI menuItem = new MenuIconClass();

                        menuItem.OnClickCommand = e.onClickCommand;
                        menuItem.ImageURL = e.imageUrl;
                        menuItem.AltText = e.alttag;
                        menuItem.ID = e.id;
                        _menuIcons.Add(menuItem);
                    }
                    catch
                    {
                    }

                    separatorPriority = curPriority;
                }
            }
        }
Esempio n. 2
0
        private void initButtons()
        {
            if (!_isInitialized)
            {
                _isInitialized = true;

                // Test for browser compliance
                if (_browserIsCompatible)
                {
                    // Add icons for the editor control:
                    // Html
                    // Preview
                    // Style picker, showstyles
                    // Bold, italic, Text Gen
                    // Align: left, center, right
                    // Lists: Bullet, Ordered, indent, undo indent
                    // Link, Anchor
                    // Insert: Image, macro, table, formular
                    _buttons.Add(
                        new editorButton("html", ui.Text("buttons", "htmlEdit", null),
                                         GlobalSettings.Path + "/images/editor/html.gif", "viewHTML('" + ClientID + "')"));
                    _buttons.Add("split");
                    _buttons.Add(
                        new editorButton("showstyles", ui.Text("buttons", "styleShow", null) + " (CTRL+SHIFT+V)",
                                         GlobalSettings.Path + "/images/editor/showStyles.gif",
                                         "umbracoShowStyles('" + ClientID + "')"));
                    _buttons.Add("split");
                    _buttons.Add(
                        new editorButton("bold", ui.Text("buttons", "bold", null) + " (CTRL+B)",
                                         GlobalSettings.Path + "/images/editor/bold.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'bold', '')"));
                    _buttons.Add(
                        new editorButton("italic", ui.Text("buttons", "italic", null) + " (CTRL+I)",
                                         GlobalSettings.Path + "/images/editor/italic.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'italic', '')"));
                    _buttons.Add(
                        new editorButton("graphicheadline", ui.Text("buttons", "graphicHeadline", null) + "(CTRL+B)",
                                         GlobalSettings.Path + "/images/editor/umbracoTextGen.gif",
                                         "umbracoTextGen('" + ClientID + "')"));
                    _buttons.Add("split");
                    _buttons.Add(
                        new editorButton("justifyleft", ui.Text("buttons", "justifyLeft", null),
                                         GlobalSettings.Path + "/images/editor/left.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'justifyleft', '')"));
                    _buttons.Add(
                        new editorButton("justifycenter", ui.Text("buttons", "justifyCenter", null),
                                         GlobalSettings.Path + "/images/editor/center.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'justifycenter', '')"));
                    _buttons.Add(
                        new editorButton("justifyright", ui.Text("buttons", "justifyRight", null),
                                         GlobalSettings.Path + "/images/editor/right.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'justifyright', '')"));
                    _buttons.Add("split");
                    _buttons.Add(
                        new editorButton("listBullet", ui.Text("buttons", "listBullet", null),
                                         GlobalSettings.Path + "/images/editor/bullist.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'insertUnorderedList', '')"));
                    _buttons.Add(
                        new editorButton("listNumeric", ui.Text("buttons", "listNumeric", null),
                                         GlobalSettings.Path + "/images/editor/numlist.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'insertOrderedList', '')"));
                    _buttons.Add(
                        new editorButton("deindent", ui.Text("buttons", "deindent", null),
                                         GlobalSettings.Path + "/images/editor/deindent.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'Outdent', '')"));
                    _buttons.Add(
                        new editorButton("indent", ui.Text("buttons", "indent", null),
                                         GlobalSettings.Path + "/images/editor/inindent.gif",
                                         "umbracoEditorCommand('" + ClientID + "', 'Indent', '')"));
                    _buttons.Add("split");
                    _buttons.Add(
                        new editorButton("linkInsert", ui.Text("buttons", "linkInsert", null),
                                         GlobalSettings.Path + "/images/editor/link.gif",
                                         "umbracoLink('" + ClientID + "')"));
                    _buttons.Add(
                        new editorButton("linkLocal", ui.Text("buttons", "linkLocal", null),
                                         GlobalSettings.Path + "/images/editor/anchor.gif",
                                         "umbracoAnchor('" + ClientID + "')"));
                    _buttons.Add("split");
                    _buttons.Add(
                        new editorButton("pictureInsert", ui.Text("buttons", "pictureInsert", null),
                                         GlobalSettings.Path + "/images/editor/image.gif",
                                         "umbracoImage('" + ClientID + "')"));
                    _buttons.Add(
                        new editorButton("macroInsert", ui.Text("buttons", "macroInsert", null),
                                         GlobalSettings.Path + "/images/editor/insMacro.gif",
                                         "umbracoInsertMacro('" + ClientID + "', '" + GlobalSettings.Path + "')"));
                    _buttons.Add(
                        new editorButton("tableInsert", ui.Text("buttons", "tableInsert", null),
                                         GlobalSettings.Path + "/images/editor/instable.gif",
                                         "umbracoInsertTable('" + ClientID + "', '" + GlobalSettings.Path + "')"));
                    _buttons.Add(
                        new editorButton("formFieldInsert", ui.Text("buttons", "formFieldInsert", null),
                                         GlobalSettings.Path + "/images/editor/form.gif",
                                         "umbracoInsertForm('" + ClientID + "', '" + GlobalSettings.Path + "')"));

                    // add save icon
                    foreach (object o in _buttons)
                    {
                        try
                        {
                            MenuIconI menuItem = new MenuIconClass();

                            editorButton e = (editorButton)o;
                            menuItem.OnClickCommand = e.onClickCommand;
                            menuItem.ImageURL = e.imageUrl;
                            menuItem.AltText = e.alttag;
                            menuItem.ID = e.id;
                            _menuIcons.Add(menuItem);
                        }
                        catch
                        {
                            _menuIcons.Add("|");
                        }
                    }
                }
            }
        }