Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: Build a context menu programatically on the server?
Re: Build a context menu programatically on the server?
03-17-2010, 10:29 PM
cutechat
Joined on 07-22-2004
Posts 2,332
Re: Build a context menu programatically on the server?
Reply
Quote
Hi,
You can intercept the CuteSoft_Client/CuteEditor/Load.ashx , to output your custom menu data.
Here is the Load.ashx code :
<%@ WebHandler language="C#" Class="EditorLoadHandler" %> using System; using System.Web; using System.Xml; using System.IO; public class EditorLoadHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { if(context.Request.QueryString["type"]=="contextmenu") { XmlDocument doc=new XmlDocument(); doc.Load( context.Server.MapPath("samplemenu.xml") ); context.Response.ContentType="text/xml"; doc.Save( context.Response.OutputStream ); } else { new CuteEditor.LoadHandler().ProcessRequest(context); } } public bool IsReusable { get { return false; } } }
Here is the menu data sample (samplemenu.xml):
<contextmenus> <dropdownitem> <FormatBlock> <item text="DIV" value="<DIV>"> <html><![CDATA[DIV]]></html> </item> <item text="Normal" value="<P>"> <html><![CDATA[Normal]]></html> </item> <item text="Heading 1" value="<H1>"> <html><![CDATA[<b style='font-size:24pt'>Heading 1</b>]]></html> </item> <item text="Heading 2" value="<H2>"> <html><![CDATA[<b style='font-size:18pt'>Heading 2</b>]]></html> </item> <item text="Heading 3" value="<H3>"> <html><![CDATA[<b style='font-size:15pt'>Heading 3</b>]]></html> </item> <item text="Heading 4" value="<H4>"> <html><![CDATA[<b style='font-size:12pt'>Heading 4</b>]]></html> </item> <item text="Heading 5" value="<H5>"> <html><![CDATA[<b style='font-size:9pt'>Heading 5</b>]]></html> </item> <item text="Heading 6" value="<H6>"> <html><![CDATA[<b style='font-size:7pt'>Heading 6</b>]]></html> </item> <item text="Address" value="<Address>"> <html><![CDATA[Address]]></html> </item> <item text="Menu List" value="<MENU>"> <html><![CDATA[Menu List]]></html> </item> <item text="Formatted" value="<PRE>"> <html><![CDATA[Formatted]]></html> </item> <item text="Definition Term" value="<DT>"> <html><![CDATA[Definition Term]]></html> </item> </FormatBlock> </dropdownitem> <dropdownitem> <FontName> <item text="Arial" html="<font size=3 face='Arial'>Arial</font>">Arial</item> <item text="Verdana" html="<font size=3 face='Verdana'>Verdana</font>">Verdana</item> <item text="Comic Sans MS" html="<font size=3 face='Comic Sans MS'>Comic Sans MS</font>">Comic Sans MS</item> <item text="Courier" html="<font size=3 face='Courier'>Courier</font>">Courier</item> <item text="Georgia" html="<font size=3 face='Georgia'>Georgia</font>">Georgia</item> <item text="Impact" html="<font size=3 face='Arial'>Impact</font>">Impact</item> <item text="Lucida Console" html="<font size=3 face='Lucida Console'>Lucida Console</font>">Lucida Console</item> <item text="Tahoma" html="<font size=3 face='Tahoma'>Tahoma</font>">Tahoma</item> <item text="Times New Roman" html="<font size=3 face='Times New Roman'>Times New Roman</font>">Times New Roman</item> <item text="Wingdings" html="<font size=3 >Wingdings</font>">Wingdings</item> </FontName> </dropdownitem> <dropdownitem> <FontSize> <item text="Not Set" value="null"> <html><![CDATA[Not Set]]></html> </item> <!-- <item text="9pt" html="<span style='font-size:9pt'>9pt</span>">9pt</item> --> <!-- <item text="12px" html="<span style='font-size:12px'>12px</span>">12px</item>--><item text="1 (8pt)" value="1"><html><![CDATA[<font size='1'>Size 1 </font>(8pt)]]></html> </item> <item text="2 (10pt)" value="2"> <html><![CDATA[<font size='2'>Size 2 </font>(10pt)]]></html> </item> <item text="3 (12pt)" value="3"> <html><![CDATA[<font size='3'>Size 3 </font>(12pt)]]></html> </item> <item text="4 (14pt)" value="4"> <html><![CDATA[<font size='4'>Size 4 </font>(14pt)]]></html> </item> <item text="5 (18pt)" value="5"> <html><![CDATA[<font size='5'>Size 5 </font>(18pt)]]></html> </item> <item text="6 (24pt)" value="6"> <html><![CDATA[<font size='6'>Size 6 </font>(24pt)]]></html> </item> <item text="7 (36pt)" value="7"> <html><![CDATA[<font size='7'>Size 7 </font>(36pt)]]></html> </item> <!-- <item text="26px" value="26px"> <html><![CDATA[<span style='font-size:26px'>26px</span>]]></html> </item> --></FontSize> </dropdownitem> <ref name="Undo" /> <spliter /> <ref name="Cut" /> <ref name="Copy" /> <ref name="Paste" /> <ref name="Delete" /> <spliter /> <ref name="SelectAll" /> <ref name="EditGroup" /> <ref name="FormattingGroup" /> <ref name="InsertGroup" /> <special type="tags" /> <special type="verbs" /> <special type="relative" /> <special type="style" /> <special type="property" /> <define name="Undo" text="Undo" command="Undo" hotkey="CTRL+Z" /> <define name="Redo" text="Redo" command="Redo" hotkey="CTRL+Y" /> <define name="Cut" text="Cut" command="Cut" hotkey="CTRL+X" /> <define name="Copy" text="Copy" command="Copy" hotkey="CTRL+C" /> <define name="Paste" text="Paste" command="Paste" hotkey="CTRL+V" /> <define name="Delete" text="Delete" command="Delete" hotkey="DELETE" /> <define name="SelectAll" text="Select All" command="SelectAll" hotkey="CTRL+A" /> <define name="PasteText" text="Paste plain text" command="PasteText" /> <define name="PasteWord" text="Paste From word" command="PasteWord" /> <define name="ToggleBorder" text="Visible Borders" command="ToggleBorder" image="borders" /> <define name="FromFullPage" text="Restore down" command="FullPage" hotkey="F12" image="restore" condition="editor.GetFullPage()" /> <define name="ToFullPage" text="Fit to Window" command="FullPage" hotkey="F12" image="fit" condition="!editor.GetFullPage()" /> <define name="Bold" text="Bold" command="Bold" hotkey="Ctrl+B" /> <define name="Italic" text="Italic" command="Italic" hotkey="Ctrl+I" /> <define name="Underline" text="Underline" command="Underline" hotkey="Ctrl+U" image="under" /> <define name="StrikeThrough" text="Strikethrough Text" command="StrikeThrough" image="strike" /> <define name="ImageGalleryByBrowsing" command="ImageGalleryByBrowsing" text="Browse Images" image="image" /> <define name="InsertImage" command="InsertImage" text="Image" image="eximage" /> <define name="InsertFlash" command="InsertFlash" text="Flash" image="flash" /> <define name="InsertMedia" command="InsertMedia" text="Media" image="media" /> <define name="InsertDocument" command="InsertDocument" text="Document" image="document" /> <define name="InsertTemplate" command="InsertTemplate" text="Template" image="template" /> <define name="InsertTable" command="InsertTable" text="Table" image="instable" /> <define name="InsertRowTop" command="InsertRowTop" text="Insert Row Above" image="instable" /> <define name="InsertRowBottom" command="InsertRowBottom" text="Insert Row Below" image="insrow_b" /> <define name="DeleteRow" command="DeleteRow" text="Delete Rows" image="delrow" /> <define name="InsertColumnLeft" command="InsertColumnLeft" text="Insert Column Left" image="inscol_l" /> <define name="InsertColumnRight" command="InsertColumnRight" text="Insert Column Right" image="inscol_r" /> <define name="DeleteColumn" command="DeleteColumn" text="Delete Columns" image="delcol" /> <define name="InsertCell" command="InsertCell" text="Insert Cells" image="inscell" /> <define name="DeleteCell" command="DeleteCell" text="Delete Cells" image="delcell" /> <define name="EditRow" command="EditRow" text="Row Properties" image="row" /> <define name="EditCell" command="EditCell" text="Cell Properties" image="cell" /> <define name="MergeRight" command="MergeRight" text="Merge cells right" image="mrgcell_r" /> <define name="MergeBottom" command="MergeBottom" text="Merge cells down" image="mrgcell_b" /> <define name="HorSplitCell" command="HorSplitCell" text="Split cells right" image="spltcell_r" /> <define name="VerSplitCell" command="VerSplitCell" text="Split cells down" image="spltcell_b" /> <define name="InsertHorizontalRule" command="InsertHorizontalRule" text="Horizontal Line" image="rule" /> <define name="InsertFieldSet" command="InsertFieldSet" text="Insert groupbox" image="groupbox" /> <define name="InsertGridLayoutPanel" command="InsertGridLayoutPanel" text="Grid Layout Panel" image="text" /> <define name="InsertParagraph" command="InsertParagraph" text="Paragraph" image="-" hotkey="Ctrl+M" /> <define name="InsertLineBreak" command="InsertLineBreak" text="Line Break" image="-" hotkey="Shift+Enter" /> <define name="InsertOrderedList" command="InsertOrderedList" text="Ordered List" image="-" /> <define name="InsertUnorderedList" command="InsertUnorderedList" text="Unordered List" image="-" /> <define name="InsertForm" command="InsertForm" text="Form" image="form" /> <define name="InsertInputText" command="InsertInputText" text="Textbox" image="textbox" /> <define name="InsertTextBox" command="InsertTextBox" text="Text Area" image="textarea" /> <define name="InsertRadioBox" command="InsertRadioBox" text="Radio Button" image="optionbutton" /> <define name="InsertCheckBox" command="InsertCheckBox" text="Checkbox" image="checkbox" /> <define name="InsertListBox" command="InsertListBox" text="ListBox" image="listbox" /> <define name="InsertDropDown" command="InsertDropDown" text="Drop Down Textbox" image="dropdownbox" /> <define name="InsertInputImage" command="InsertInputImage" text="Image Button" image="imagebutton" /> <define name="InsertInputSubmit" command="InsertInputSubmit" text="Submit Button" image="submit" /> <define name="InsertInputReset" command="InsertInputReset" text="Reset Button" image="Reset" /> <define name="InsertInputPassword" command="InsertInputPassword" text="Password Field" image="passwordfield" /> <define name="InsertInputHidden" command="InsertInputHidden" text="Hidden" image="hiddenfield" /> <define name="InsertInputButton" command="InsertInputButton" text="Button" image="pushbutton" /> <define name="Paste" command="Paste" text="Paste" /> <define name="PasteText" command="PasteText" text="Paste plain text" /> <define name="PasteWord" command="PasteWord" text="Paste From word" /> <define name="PasteAsHTML" command="PasteAsHTML" text="Paste As HTML" /> <define name="EditGroup" text="Edit"> <subItems> <ref name="Undo" /> <ref name="Redo" /> <spliter /> <ref name="SelectAll" /> <ref name="PasteText" /> <ref name="PasteWord" /> <spliter /> <ref name="ToggleBorder" /> <ref name="FromFullPage" /> <ref name="ToFullPage" /> </subItems> <initializer><![CDATA[ ]]></initializer> </define> <define name="FormattingGroup" text="Formatting"> <subItems> <item name="FormatBlockGroup" text="Paragraph" dropdown="FormatBlock" /> <item name="FontNameGroup" text="Default Font" dropdown="FontName" /> <item name="FontSizeGroup" text="Size" dropdown="FontSize" /> <ref name="Bold" /> <ref name="Italic" /> <ref name="Underline" /> <ref name="StrikeThrough" /> </subItems> </define> <define name="InsertGroup" text="Insert"> <subItems> <ref name="ImageGalleryByBrowsing" /> <ref name="InsertImage" /> <ref name="InsertFlash" /> <ref name="InsertMedia" /> <ref name="InsertDocument" /> <ref name="InsertTemplate" /> <spliter /> <ref name="InsertTable" /> <ref name="InsertHorizontalRule" /> <spliter /> <ref name="InsertAdvancedGroup" /> <ref name="InsertFormGroup" /> </subItems> </define> <define name="InsertAdvancedGroup" text="Advanced"> <subItems> <ref name="InsertParagraph" /> <ref name="InsertLineBreak" /> <ref name="InsertOrderedList" /> <ref name="InsertUnorderedList" /> <ref name="InsertFieldSet" /> <ref name="InsertGridLayoutPanel" /> </subItems> </define> <define name="InsertFormGroup" text="Form"> <subItems> <ref name="InsertForm" /> <ref name="InsertInputText" /> <ref name="InsertTextBox" /> <ref name="InsertRadioBox" /> <ref name="InsertCheckBox" /> <ref name="InsertListBox" /> <ref name="InsertDropDown" /> <ref name="InsertInputImage" /> <ref name="InsertInputSubmit" /> <ref name="InsertInputReset" /> <ref name="InsertInputPassword" /> <ref name="InsertInputHidden" /> <ref name="InsertInputButton" /> </subItems> </define> <define name="InsertTableGroup" text="Table"> <subItems> <ref name="InsertTable" /> <ref name="InsertRowTop" /> <ref name="InsertRowBottom" /> <ref name="DeleteRow" /> <ref name="InsertColumnLeft" /> <ref name="InsertColumnRight" /> <ref name="DeleteColumn" /> <ref name="InsertCell" /> <ref name="DeleteCell" /> <ref name="EditRow" /> <ref name="EditCell" /> <ref name="MergeRight" /> <ref name="MergeBottom" /> <ref name="HorSplitCell" /> <ref name="VerSplitCell" /> </subItems> </define> <define name="PasteGroup" text="Paste"> <subItems> <ref name="Paste" /> <ref name="PasteText" /> <ref name="PasteWord" /> <ref name="PasteAsHTML" /> </subItems> </define> </contextmenus>
Regards,
Terry
View Complete Thread