Welcome Guest Search | Active Topics | Sign In | Register

Editor Options
Ronel
Posted: Saturday, December 20, 2008 1:11:05 PM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
I want to remove the "New" and "Save" items from the Editor's toolbar. How can I do it?

thank you
eo_support
Posted: Saturday, December 20, 2008 2:08:17 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You would need to set the Editor's ToolBarSet and ToolBarItems property. Please see details here:

http://www.essentialobjects.com/ViewDoc.aspx?t=Editor%2fcustomize_toolbar.html

Thanks!
Ronel
Posted: Saturday, December 20, 2008 2:18:58 PM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
No, that doesn't help because I need then to know every single command name there is. Also I'll be forced to fill the drop down items that are already filled by default and on it goes.
I tried "Remove" but the toolbaritems collection is empty.

I need a better solution than re-inventing the water. I just need to take away a toolbar item, there must be a way I HOPE...

eo_support
Posted: Saturday, December 20, 2008 2:31:57 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Have you tried to right click the editor, then choose "Edit Template" -> "CustomHeaderTemplate"? That would put out the default toolbars out there for you to edit. Details about this approach can still be found in the above link, under "Using Custom Header Layout" section. Since this way you can edit the toolbar directly, you may also need to take a look of the toolbar documentation.

You do not need to fill the drop down items as soon as you use the pre-defined command names. The editor recognizes those names and it will automatically fill them for you.

Hope this helps.

Thanks!
Ronel
Posted: Saturday, December 20, 2008 2:40:43 PM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
Thank you, that worked.
Ronel
Posted: Saturday, December 20, 2008 2:44:24 PM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
But it reversed back after I change it, why?
eo_support
Posted: Saturday, December 20, 2008 3:15:16 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The page should not change by itself. If it does, it's most likely a Visual Studio problem. If you believe it's our problem, please provide detailed step by step information about how to reproduce the problem. Once we have that we will be happy to take a look.

If the page reverse back after any of your action, it should be easy for you to find out what you have done and undo it. In any case, the runtime behavior is determined by your .aspx page. Everything you do at design view is just helping you modify the page markup. So you can always switch to .aspx view and to modify the markup directly. It is exactly for this reason our documentation mostly focus on .aspx markup syntax.

Thanks!
Ronel
Posted: Tuesday, December 23, 2008 8:32:11 AM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
Well I got that to work despite it all.
I have another issue. In one page in my site I need to create the Editor and its Dialogs (InsertOrEditImage and FileExplorer) from code because I don't have ascx available.

Is this possible?
This is what I have tried so far:
var myControl = new EO.Web.Editor();
myControl.FileExplorerUrl = "~/digitalassetExplorer.aspx";
myControl.ImageBaseDirectory = string.Format("~{0}",Config.DigitalAssetsBasePath);
myControl.PreserveRelativePaths = true;
myControl.SkinID = "EO.Editor";
myControl.FileExplorerDialogID = "FileExplorerDialog1";
myControl.ID = "Editor";
and added a skin file with a full dialog and custom dialogs as follow:

<DialogContents>
<eo:EditorDialogContent CommandName="InsertOrEditImage">
<ContentTemplate>
<table cellspacing="3" cellpadding="1" border="0">
<tr>
<td width="60px" nowrap="nowrap">Url:</td>
<td colspan="3" nowrap="nowrap">
<input type="text" name="eo_editor_insertimage_url" style="width:230px;" /><input type="button" style="width:20px" value="..." onclick="eo_GetContainer(this, 'Editor').browseFile(this, 'eo_editor_insertimage_url', 'Browse Image', 'image');" />
</td>
</tr>
<tr>
<td>Description:</td>
<td colspan="3">
<input type="text" name="eo_editor_insertimage_desc" style="width:250px;" />
</td>
</tr>
<tr>
<td align="right" colspan="4">
<input type="button" name="eo_editor_default_button" value="OK" style="width:80px;" onclick="eo_GetContainer(this, 'Editor').execDialogCommand('InsertOrEditImage', this, event);" />&nbsp;
<input type="button" value="Close" style="width:80px;" onclick="eo_GetContainer(this, 'Editor').closeDialog(this, event);" />
</td>
</tr>
</table>
</ContentTemplate>
</eo:EditorDialogContent>
<eo:EditorDialogContent CommandName="image">
<ContentTemplate>
<div style="left:20px;">
<eo:Dialog runat="server" id="FileExplorerDialog1" Width="320px" Height="216px" ControlSkinID="None"
HeaderHtml="Dialog Title" CloseButtonUrl="00020440" AllowResize="True" HeaderHtmlFormat='<div style="padding-top:4px">{0}</div>'
HeaderImageUrl="00020441" HeaderImageHeight="27" MinWidth="150" MinHeight="100" AcceptButton="OK"
CancelButton="Cancel">
<ContentTemplate>
<eo:FileExplorerHolder runat="server" id="Explorer1" Width="710px" Height="350px"></eo:FileExplorerHolder>
<div style="padding: 10px 10px 10px 10px; text-align:right;">
<asp:Button Runat="server" ID="OK" Text="OK" style="width:80px"></asp:Button>
<asp:Button Runat="server" ID="Cancel" Text="Cancel" style="width:80px"></asp:Button>
</div>
</ContentTemplate>
<FooterStyleActive CssText="padding-right: 4px; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; padding-top: 4px; font-family: tahoma"></FooterStyleActive>
<HeaderStyleActive CssText="background-image:url(00020442);color:#444444;font-family:'trebuchet ms';font-size:10pt;font-weight:bold;padding-bottom:7px;padding-left:8px;padding-right:0px;padding-top:0px;"></HeaderStyleActive>
<ContentStyleActive CssText="background-color:#f0f0f0;font-family:tahoma;font-size:8pt;padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px"></ContentStyleActive>
<BorderImages BottomBorder="00020409,00020429" RightBorder="00020407,00020427" TopRightCornerBottom="00020405,00020425"
TopRightCorner="00020403,00020423" LeftBorder="00020406,00020426" TopLeftCorner="00020401,00020421"
BottomRightCorner="00020410,00020430" TopLeftCornerBottom="00020404,00020424" BottomLeftCorner="00020408,00020428"
TopBorder="00020402,00020422"></BorderImages>
</eo:Dialog>
</div>
</ContentTemplate>
</eo:EditorDialogContent>
</DialogContents>

The issue is that after selecting the image the result goes nowhere, so I was trying to replace all that for a complete code-based solution. Can you help?

thanks
Ronel
eo_support
Posted: Tuesday, December 23, 2008 9:40:14 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I do not think skin file picks up JavaScript code for you (also skin file may not work well with many complex properties on the Editor either). So I would definitely think using an .ascx is the easiest. You can put the whole Editor inside an .ascx file and then load it dynamically with code. An alternative is to place the Editor inside your page, then set its Visible to true or false to show/hide it. You can of course build the whole EditorDialogContent with code, but there are just two many properties for you to set. So it may not be worth it at all.

Hope this helps.

Thanks!
Ronel
Posted: Tuesday, December 23, 2008 9:45:47 AM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
I'll try the option that loads dynamically the control in a separate ascx and let you know how it goes.
Ronel
Posted: Tuesday, December 23, 2008 9:58:59 AM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
Well, there is not easy way for me to add an ascx in the project (.cproj) that I'm working on. The ony place I was stuck in was at the time of creating the ContentTemplate programatically.

Would you have a small example of that?
eo_support
Posted: Tuesday, December 23, 2008 10:16:19 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That part is a bit tricky. I believe you will need to implement ITemplate. It will be something like this:

Code: C#
class YourDialogContent: ITemplate
{
    public void InstantiateIn(Control container)
    {
        //Dynamically adding new controls here.....
        Label label = new Label();
        container.Controls.Add(label);
    }
}

Dialog1.ContentTemplate = new YourDialogContent();


The dialog will then prepare a container control and call your InstantiateIn to create the dialog content.

Hope this helps.

Thanks
Ronel
Posted: Tuesday, December 23, 2008 11:20:39 AM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
Thanks.
I tried this and the ContentTemplate stays empty. Are we missing something else with the use of InstantiateIn? or another way of using the code?


eo_support
Posted: Tuesday, December 23, 2008 11:32:46 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Can you post the full code you have?
Ronel
Posted: Tuesday, December 23, 2008 11:45:50 AM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
Code: C#
#region [ RichText ]
                    {
                        var myControl = new EO.Web.Editor();// WebHtmlEditor { SkinID = "WizardHtmlEditor" };
                        myControl.FileExplorerUrl = "~/Services/digitalasset/digitalassetExplorer.aspx";
                        myControl.ImageBaseDirectory = string.Format("~{0}",clsKernel.Config.DigitalAssetsBasePath);
                        myControl.PreserveRelativePaths = true;
                        myControl.SkinID = "EO.Editor";
                        myControl.FileExplorerDialogID = "FileExplorerDialog1";
                        myControl.ID = "Editor";
                        
                        EditorDialogContent dialogContent = new EditorDialogContent();
                        dialogContent.CommandName = "InsertOrEditImage";
                        dialogContent.ContentTemplate = new MyInsertImageContent();
                        dialogContent.ID="FileExplorerDialog1";
                        myControl.DialogContents.Add(dialogContent);
                        dialogContent.Dispose();

                        dialogContent = new EditorDialogContent();
                        dialogContent.CommandName = "image";
                        //dialogContent.ContentTemplate = new MyInsertImageContent();
                        myControl.DialogContents.Add(dialogContent);


                        control = myControl;
                        break;
                    }
                    #endregion


class MyInsertImageContent: ITemplate
    {
        public void InstantiateIn(System.Web.UI.Control container)
        {
            //Dynamically adding new controls here.....
            Table table =  new Table();
            table.CellSpacing=3;
            table.CellPadding=1;
            table.BorderWidth=0;
            
            TableRow trow = new TableRow();
                TableCell tcell = new TableCell();
                tcell.Width=60;
                tcell.Wrap=false;
                tcell.Text = "Url:";
            trow.Cells.Add(tcell);
                //tcell.Dispose();
                tcell = new TableCell();
                tcell.ColumnSpan = 3;
                tcell.Wrap = false;
                    HtmlInputText input = new HtmlInputText();
                    input.Name = "eo_editor_insertimage_url";
                    input.ID = "eo_editor_insertimage_url";
                    input.Size = 230;
                    input.Value = "";
                tcell.Controls.Add(input);
                    HtmlInputButton button = new HtmlInputButton();
                    button.Value = "...";
                    //button.Style.Keys = 20;
                    //button..Attributes.Add("onclick", "eo_GetContainer(this, 'Editor').browseFile(this,eo_editor_insertimage_url', 'Browse Image', 'image');");
                tcell.Controls.Add(button);
    
            trow.Cells.Add(tcell);
            table.Rows.Add(trow);

            container.Controls.Add(table);
        }
    }


Ronel
Posted: Tuesday, December 23, 2008 11:47:41 AM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
It is not empty, I found the "eo_editor_insertimage_ur" component but with a huge name. That brings also another issue/question: can I have more than one editor in one page? (not critical, but curious about this)
eo_support
Posted: Tuesday, December 23, 2008 12:10:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Ronel wrote:
It is not empty

Thanks for the update. It's much appreciated when you try to verify/troubleshoot the problem before posting in the forum. That saves time and resource for both of us.


Ronel wrote:

, I found the "eo_editor_insertimage_ur" component but with a huge name. That brings also another issue/question: can I have more than one editor in one page? (not critical, but curious about this)

You can. The ID does not matter. Only the element name matters. The editor searches for an element with the matching name within the dialog. That's why you need to pass "this" to execDialogCommand. That identifies which dialog you are currently in.
Ronel
Posted: Tuesday, December 23, 2008 12:27:20 PM
Rank: Member
Groups: Member

Joined: 12/14/2008
Posts: 16
I said "name" huge, not ID.
When I said "empty" it was because the component couldn't find eo_editor_insertimage_url and still can't find it because it has a HUGE name as I tried to indicate.
The thing you are saying about "this" is for something else.

I'm sorry that you need to look at my questions, but the documentation and the search and not that helpful. Believe me that I rather not ask anything if I get good source for research.

You may consider that, because it will save you guys quite a bit of money in the long run (just a thought)

eo_support
Posted: Tuesday, December 23, 2008 12:58:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Sorry about the ID and Name confusion. HtmlInputText.Name is not the same as the name attribute. It always returns the control's unique ID (the huge name that you saw) and I believe setting it does nothing.

I can think of two ways to get around this:

1. Use

Code: C#
input.Attributes["name"] = "eo_editor_insertimage_ur";


2. Use a LiteralControl to place all the HTML directly in with a single call. It will be something like this:

Code: C#
LiteralControl l = new LiteralControl(@"
&lt;table cellspacing=""3"" cellpadding=""1"" border=""0""&gt;
.....
&lt;/table&gt;");
container.Controls.Add(l);


This way you don't have to write all the code to create the content piece by piece. LiteralControl is convenient when you don't need to manipulate anything on control level.

My previous comment is about your question about ContentTemplate stays empty and then noticed that it is not. That doesn't have to do with documentation. Creating an ITemplate programmatically is very much a generic ASP.NET programming technique, so it really doesn't have much to do with our product and there is no reason for our documentation to cover that. Our documentation and support response time is actually among the best in the industry. Nevertheless, please be rest assured that we will always be trying to improve on our product, documentation, support and everything else that can serve our users better.

Hope this helps.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.