Changeset 1201
- Timestamp:
- 2007-12-13 19:32:16 (9 months ago)
- Location:
- FCKeditor.Net/trunk/_samples/aspx
- Files:
-
- 3 added
- 4 removed
- 5 modified
-
1.1/sample01.aspx (modified) (3 diffs)
-
1.1/sample02.aspx (modified) (2 diffs)
-
1.1/sample02.aspx.cs (modified) (3 diffs)
-
1.1/sample03.ascx (deleted)
-
1.1/sample03.ascx.cs (deleted)
-
1.1/sample03.ascx.resx (deleted)
-
1.1/sample03.aspx (modified) (2 diffs)
-
1.1/sample03.aspx.cs (modified) (3 diffs)
-
1.1/sample04.aspx (added)
-
1.1/sample04.aspx.cs (added)
-
1.1/sampleposteddata.aspx (deleted)
-
default.html (added)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor.Net/trunk/_samples/aspx/1.1/sample01.aspx
r1167 r1201 1 <%@ Page ValidateRequest="false" Language="C#" AutoEventWireup="false" %> 1 <%@ Page Language="C#" AutoEventWireup="false" %> 2 2 3 <%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %> 3 4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> … … 25 26 --%> 26 27 <script runat="server" language="C#"> 27 // This sample doesnt use a code behind file to avoid the user to have to compile 28 // the page to run it. 28 29 // In this page, we are placing all server side code inline to the page, to 30 // avoid having to compile the page in your web site to run it. 31 // Of course it would work in the same way with Code Behind. 32 29 33 protected override void OnLoad(EventArgs e) 30 34 { … … 35 39 int iIndex = sPath.LastIndexOf( "_samples") ; 36 40 FCKeditor1.BasePath = sPath.Remove( iIndex, sPath.Length - iIndex ) ; 41 42 if ( Page.IsPostBack ) 43 return; 44 45 // Set the startup editor value. 46 FCKeditor1.Value = "<p>This is some <strong>sample text</strong>. You are using <a href=\"http://www.fckeditor.net/\">FCKeditor</a>.</p>"; 37 47 } 48 49 protected void BtnSubmit_Click( object sender, EventArgs e ) 50 { 51 // For sample purposes, print the editor value at the bottom of the 52 // page. Note that we are encoding the value, so it will be printed as 53 // is, intead of rendering it. 54 LblPostedData.Text = HttpUtility.HtmlEncode( FCKeditor1.Value ); 55 56 // Make the posted data block visible. 57 PostedDataBlock.Visible = true; 58 PostedAlertBlock.Visible = true; 59 } 60 38 61 </script> 39 <html> 40 <head> 41 <title>FCKeditor - Sample</title> 42 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 43 <meta name="robots" content="noindex, nofollow"> 44 <link href="../sample.css" rel="stylesheet" type="text/css" /> 45 <script type="text/javascript"> 46 47 function FCKeditor_OnComplete( editorInstance ) 48 { 49 window.status = editorInstance.Description ; 50 } 51 52 </script> 53 </head> 54 <body> 55 <h1>FCKeditor - ASP.Net - Sample 1</h1> 56 This sample displays a normal HTML form with an FCKeditor with full features 57 enabled. 58 <br> 59 No code behind is used so you don't need to compile the ASPX pages to make it 60 work. All other samples use code behind. 61 <hr> 62 <form action="sampleposteddata.aspx" method="post" target="_blank"> 63 <FCKeditorV2:FCKeditor id="FCKeditor1" runat="server" value='This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.'></FCKeditorV2:FCKeditor> 64 <br> 65 <input type="submit" value="Submit"> 66 </form> 67 </body> 62 <html xmlns="http://www.w3.org/1999/xhtml"> 63 <head> 64 <title>FCKeditor - Sample</title> 65 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 66 <meta name="robots" content="noindex, nofollow" /> 67 <link href="../sample.css" rel="stylesheet" type="text/css" /> 68 <style type="text/css"> 69 pre { background-color: #f5f5f5; padding: 5px; border: #d3d3d3 1px solid; } 70 </style> 71 </head> 72 <body> 73 <form runat="server"> 74 <h1> 75 FCKeditor - ASP.NET - Sample 1 76 </h1> 77 <p> 78 This sample displays a normal HTML form with an FCKeditor with full features enabled. 79 </p> 80 <p> 81 No code behind is used so you don't need to compile the ASPX pages to make it work. 82 All other samples use code behind. 83 </p> 84 <p id="PostedAlertBlock" style="color: Red" runat="server" visible="false"> 85 The posted data has been printed at the bottom of the page. 86 </p> 87 <p> 88 <!--- 89 Here we have the FCKeditor component tag. It has been created 90 by dragging the FCKeditor icon from the toolbar to the page, in design mode. 91 ---> 92 <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server"> 93 </FCKeditorV2:FCKeditor> 94 </p> 95 <p> 96 <asp:Button ID="BtnSubmit" runat="server" OnClick="BtnSubmit_Click" Text="Submit" /> 97 </p> 98 </form> 99 <div id="PostedDataBlock" runat="server" visible="false"> 100 <p> 101 Posted data: 102 </p> 103 <pre><asp:Label ID="LblPostedData" runat="server"></asp:Label></pre> 104 </div> 105 </body> 68 106 </html> -
FCKeditor.Net/trunk/_samples/aspx/1.1/sample02.aspx
r1167 r1201 1 <%@ Page ValidateRequest="false" language="c#" Codebehind="sample02.aspx.cs" Inherits="FredCK.FCKeditorV2.Samples.Sample02" AutoEventWireup="false" %> 2 <%@ Register TagPrefix="fckeditorv2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %> 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 1 <%@ Page language="c#" Codebehind="sample02.aspx.cs" AutoEventWireup="false" Inherits="FredCK.FCKeditorV2.Samples.Sample02" %> 2 3 <%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 5 <%-- 5 6 * FCKeditor - The text editor for Internet - http://www.fckeditor.net … … 24 25 * Sample page. 25 26 --%> 26 <html> 27 <head> 28 <title>FCKeditor - Sample</title> 29 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 30 <meta name="robots" content="noindex, nofollow"> 31 <link href="../sample.css" rel="stylesheet" type="text/css"> 32 <script type="text/javascript"> 27 <html xmlns="http://www.w3.org/1999/xhtml"> 28 <head> 29 <title>FCKeditor - Sample</title> 30 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 31 <meta name="robots" content="noindex, nofollow" /> 32 <link href="../sample.css" rel="stylesheet" type="text/css" /> 33 <style type="text/css"> 34 pre { background-color: #f5f5f5; padding: 5px; border: #d3d3d3 1px solid; } 35 </style> 36 <script type="text/javascript"> 33 37 38 // 39 // Here we are using JavaScript to retrieve the available languages from 40 // FCKeditor. This is completely optional and is needed onl for sample purposes. 41 // 42 // It shows also how to interact with the editor instance through JavaScript. 43 // 44 45 /** 46 * FCKeditor_OnComplete is a special function which is called when an FCKeditor 47 * instance is loaded on the page and available for code interaction. 48 */ 34 49 function FCKeditor_OnComplete( editorInstance ) 35 50 { 36 window.status = editorInstance.Description ; 51 // Get the language combo. 52 var combo = document.getElementById( 'xLanguages' ) ; 53 54 // Remove all options. (#1399) 55 combo.innerHTML = '' ; 56 57 // Retrieve the available languages object. 58 var availableLanguages = editorInstance.Language.AvailableLanguages ; 59 60 // Fill an array with all available languages. 61 var languages = new Array() ; 62 for ( code in availableLanguages ) 63 languages.push( { Code : code, Name : availableLanguages[code] } ) ; 64 65 // Sort the array using a custom comparison function. 66 languages.sort( SortLanguage ) ; 67 68 // Add all languages to the combo. 69 for ( var i = 0 ; i < languages.length ; i++ ) 70 AddComboOption( combo, languages[i].Name + ' (' + languages[i].Code + ')', languages[i].Code ) ; 71 72 // Set the combo value to the current language. 73 combo.value = editorInstance.Language.ActiveLanguage.Code ; 74 75 combo.style.visibility = '' ; 37 76 } 38 77 39 </script> 40 </head> 41 <body> 42 <h1>FCKeditor - ASP.Net - Sample 2</h1> 43 This sample displays a normal HTML form with an FCKeditor with full features 44 enabled. 45 <br> 46 The only difference from sample01 is that this page uses code behind and the 47 submitted data is shown in the page itself. 48 <hr> 49 <form method="post" runat="server"> 50 <FCKeditorV2:FCKeditor id="FCKeditor1" runat="server" /> 51 <br> 52 <input id="btnSubmit" type="submit" value="Submit" runat="server"> 53 </form> 54 <div id="eSubmittedDataBlock" runat="server"> 55 <hr> 56 This is the submitted data:<br> 57 <textarea id="txtSubmitted" runat="server" rows="10" cols="60" style="WIDTH: 100%" readonly></textarea> 78 /** 79 * Custom function to sort the language entries. 80 */ 81 function SortLanguage( langA, langB ) 82 { 83 return ( langA.Name < langB.Name ? -1 : langA.Name > langB.Name ? 1 : 0 ) ; 84 } 85 86 /** 87 * Utility function to append options in a <select> element. 88 */ 89 function AddComboOption( combo, optionText, optionValue ) 90 { 91 var option = document.createElement( 'option' ) ; 92 93 combo.options.add( option ) ; 94 95 option.innerHTML = optionText ; 96 option.value = optionValue ; 97 98 return option ; 99 } 100 101 /** 102 * Reloads the page, passing the specified language code in the querystring. 103 */ 104 function ChangeLanguage( languageCode ) 105 { 106 window.location.href = window.location.pathname + "?lang=" + languageCode ; 107 } 108 109 </script> 110 </head> 111 <body> 112 <form runat="server"> 113 <h1> 114 FCKeditor - ASP.NET - Sample 2</h1> 115 <p> 116 This sample shows the editor in all its available languages. 117 </p> 118 <hr /> 119 <table cellpadding="0" cellspacing="0" border="0"> 120 <tr> 121 <td> 122 Select a language: 123 </td> 124 <td> 125 <select id="xLanguages" onchange="ChangeLanguage(this.value);" style="visibility: hidden"> 126 <option> </option> 127 </select> 128 </td> 129 </tr> 130 </table> 131 <p id="PostedAlertBlock" style="color: Red" runat="server" visible="false"> 132 The posted data has been printed at the bottom of the page. 133 </p> 134 <div style="margin-top: 10px;"> 135 <!--- 136 Here we have the FCKeditor component tag. It has been created 137 by dragging the FCKeditor icon from the toolbar to the page, in design mode. 138 ---> 139 <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server"> 140 </FCKeditorV2:FCKeditor> 58 141 </div> 59 </body> 142 <p> 143 <asp:Button ID="BtnSubmit" runat="server" Text="Submit" OnClick="BtnSubmit_Click" /> 144 </p> 145 <div id="PostedDataBlock" runat="server" visible="false"> 146 <p> 147 Posted data: 148 </p> 149 <pre><asp:Label ID="LblPostedData" runat="server"></asp:Label></pre> 150 </div> 151 </form> 152 </body> 60 153 </html> -
FCKeditor.Net/trunk/_samples/aspx/1.1/sample02.aspx.cs
r1164 r1201 14 14 public class Sample02 : System.Web.UI.Page 15 15 { 16 protected System.Web.UI.HtmlControls.HtmlTextArea txtSubmitted;17 protected System.Web.UI.HtmlControls.HtmlInputButton btnSubmit;18 protected System.Web.UI.HtmlControls.HtmlGenericControl eSubmittedDataBlock;19 20 16 protected FredCK.FCKeditorV2.FCKeditor FCKeditor1; 17 protected System.Web.UI.WebControls.Button BtnSubmit; 18 protected System.Web.UI.WebControls.Label LblPostedData; 19 protected System.Web.UI.HtmlControls.HtmlGenericControl PostedAlertBlock; 20 protected System.Web.UI.HtmlControls.HtmlGenericControl PostedDataBlock; 21 21 22 22 private void Page_Load(object sender, System.EventArgs e) 23 23 { 24 // We'll do initializartion settings in the editor only the first time. 25 // Once the page is submitted, nothing must be done in the OnLoad. 24 // Set the base path. This is the URL path for the FCKeditor 25 // installations. By default "/fckeditor/". 26 FCKeditor1.BasePath = this.GetBasePath(); 27 28 if ( Request.QueryString[ "lang" ] != null ) 29 { 30 // Disable the language automatic detection (note that we always use strings). 31 FCKeditor1.Config[ "AutoDetectLanguage" ] = "false"; 32 33 // Set the language to the querystring value. 34 FCKeditor1.Config[ "DefaultLanguage" ] = Request.QueryString[ "lang" ]; 35 } 36 else 37 { 38 // Enable language automatic detection (default). 39 FCKeditor1.Config[ "AutoDetectLanguage" ] = "true"; 40 41 // Set the default language to English (default). Used if the user 42 //language is not available in FCKeditor. 43 FCKeditor1.Config[ "DefaultLanguage" ] = "en"; 44 } 45 26 46 if ( Page.IsPostBack ) 27 return ;47 return; 28 48 29 eSubmittedDataBlock.Visible = false ; 30 31 // Automatically calculates the editor base path based on the _samples directory. 32 // This is usefull only for these samples. A real application should use something like this: 33 // FCKeditor1.BasePath = '/FCKeditor/' ; // '/FCKeditor/' is the default value. 34 string sPath = Request.Url.AbsolutePath ; 35 int iIndex = sPath.LastIndexOf( "_samples") ; 36 sPath = sPath.Remove( iIndex, sPath.Length - iIndex ) ; 37 38 FCKeditor1.BasePath = sPath ; 39 FCKeditor1.Value = "This is some <strong>sample text</strong>. You are using <a href=\"http://www.fckeditor.net/\">FCKeditor</a>." ; 40 FCKeditor1.ImageBrowserURL = sPath + "editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/aspx/connector.aspx" ; 41 FCKeditor1.LinkBrowserURL = sPath + "editor/filemanager/browser/default/browser.html?Connector=connectors/aspx/connector.aspx" ; 49 // Set the startup editor value. 50 FCKeditor1.Value = "<p>This is some <strong>sample text</strong>. You are using <a href=\"http://www.fckeditor.net/\">FCKeditor</a>.</p>"; 42 51 } 43 52 … … 50 59 InitializeComponent(); 51 60 base.OnInit(e); 52 53 // This events declarations has been moved to the "OnInit" method54 // to avoid a bug in Visual Studio to delete then without any advice.55 this.Load += new System.EventHandler(this.Page_Load);56 this.btnSubmit.ServerClick += new System.EventHandler(this.btnSubmit_ServerClick);57 61 } 58 62 … … 63 67 private void InitializeComponent() 64 68 { 69 this.BtnSubmit.Click += new System.EventHandler(this.BtnSubmit_Click); 70 this.Load += new System.EventHandler(this.Page_Load); 65 71 66 72 } 67 73 #endregion 68 74 69 private void btnSubmit_ServerClick(object sender, System.EventArgs e) 75 /// <summary> 76 /// Automatically calculates the editor base path based on the _samples 77 /// directory. This is usefull only for these samples. A real application 78 /// should use something like this instead: 79 /// <code> 80 /// FCKeditor1.BasePath = "/fckeditor/" ; // "/fckeditor/" is the default value. 81 /// </code> 82 /// </summary> 83 private string GetBasePath() 70 84 { 71 eSubmittedDataBlock.Visible = true ; 72 txtSubmitted.Value = HttpUtility.HtmlEncode( FCKeditor1.Value ) ; 85 string path = Request.Url.AbsolutePath; 86 int index = path.LastIndexOf( "_samples" ); 87 return path.Remove( index, path.Length - index ); 88 } 89 90 protected void BtnSubmit_Click( object sender, EventArgs e ) 91 { 92 // For sample purposes, print the editor value at the bottom of the 93 // page. Note that we are encoding the value, so it will be printed as 94 // is, intead of rendering it. 95 LblPostedData.Text = HttpUtility.HtmlEncode( FCKeditor1.Value ); 96 97 // Make the posted data block visible. 98 PostedDataBlock.Visible = true; 99 PostedAlertBlock.Visible = true; 73 100 } 74 101 } -
FCKeditor.Net/trunk/_samples/aspx/1.1/sample03.aspx
r1167 r1201 1 <%@ Page language="c#" Codebehind="sample03.aspx.cs" AutoEventWireup="false" Inherits="FredCK.FCKeditorV2.Samples.sample03" %> 2 <%@ Register TagPrefix="uc1" TagName="sample03" Src="sample03.ascx" %> 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 1 <%@ Page language="c#" Codebehind="sample03.aspx.cs" AutoEventWireup="false" Inherits="FredCK.FCKeditorV2.Samples.Sample03" %> 2 3 <%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 5 <%-- 5 6 * FCKeditor - The text editor for Internet - http://www.fckeditor.net … … 24 25 * Sample page. 25 26 --%> 26 <html> 27 <head> 28 <title>FCKeditor - Sample</title> 29 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 30 <meta name="robots" content="noindex, nofollow"> 31 <link href="../sample.css" rel="stylesheet" type="text/css"> 32 <script type="text/javascript"> 33 34 function FCKeditor_OnComplete( editorInstance ) 35 { 36 window.status = editorInstance.Description ; 37 } 38 39 </script> 40 </head> 41 <body> 42 <h1>FCKeditor - ASP.Net - Sample 3</h1> 43 This sample displays a normal HTML form with an FCKeditor with full features 44 enabled. 45 <br> 46 The only difference from sample02 is that this page uses a custom control that 47 includes the editor in the back. This is a test page to see if the editor works 48 over a control tree hierarchy. 49 <hr> 50 <form method="post" runat="server"> 51 <uc1:sample03 id="MyCustomControl" runat="server"></uc1:sample03> 52 <br> 53 <input id="btnSubmit" type="submit" value="Submit" runat="server"> 54 </form> 55 <div id="eSubmittedDataBlock" runat="server"> 56 <hr> 57 This is the submitted data:<br> 58 <textarea id="txtSubmitted" runat="server" rows="10" cols="60" style="WIDTH: 100%" readonly></textarea> 27 <html xmlns="http://www.w3.org/1999/xhtml"> 28 <head> 29 <title>FCKeditor - Sample</title> 30 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 31 <meta name="robots" content="noindex, nofollow" /> 32 <link href="../sample.css" rel="stylesheet" type="text/css" /> 33 <style type="text/css"> 34 pre { background-color: #f5f5f5; padding: 5px; border: #d3d3d3 1px solid; } 35 </style> 36 </head> 37 <body> 38 <form runat="server"> 39 <h1> 40 FCKeditor - ASP.NET - Sample 3</h1> 41 <div> 42 This sample shows how to change the editor toolbar. 59 43 </div> 60 </body> 44 <hr /> 45 <table cellpadding="0" cellspacing="0" border="0"> 46 <tr> 47 <td style="height: 21px"> 48 Select the toolbar to load: 49 </td> 50 <td style="height: 21px"> 51 <asp:DropDownList ID="cmbToolbars" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbToolbars_SelectedIndexChanged"> 52 <asp:ListItem Selected="True">Default</asp:ListItem> 53 <asp:ListItem>Basic</asp:ListItem> 54 </asp:DropDownList> </td> 55 </tr> 56 </table> 57 <p id="PostedAlertBlock" style="color: Red" runat="server" visible="false"> 58 The posted data has been printed at the bottom of the page. 59 </p> 60 <div style="margin-top: 10px;"> 61 <!--- 62 Here we have the FCKeditor component tag. It has been created 63 by dragging the FCKeditor icon from the toolbar to the page, in design mode. 64 ---> 65 <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server"> 66 </FCKeditorV2:FCKeditor> 67 </div> 68 <p> 69 <asp:Button ID="BtnSubmit" runat="server" Text="Submit" OnClick="BtnSubmit_Click" /> 70 </p> 71 <div id="PostedDataBlock" runat="server" visible="false"> 72 <p> 73 Posted data: 74 </p> 75 <pre><asp:Label ID="LblPostedData" runat="server"></asp:Label></pre> 76 </div> 77 </form> 78 </body> 61 79 </html> -
FCKeditor.Net/trunk/_samples/aspx/1.1/sample03.aspx.cs
r1164 r1201 12 12 namespace FredCK.FCKeditorV2.Samples 13 13 { 14 public class sample03 : System.Web.UI.Page14 public class Sample03 : System.Web.UI.Page 15 15 { 16 protected System.Web.UI.HtmlControls.HtmlInputButton btnSubmit; 17 protected System.Web.UI.HtmlControls.HtmlGenericControl eSubmittedDataBlock; 18 protected System.Web.UI.HtmlControls.HtmlTextArea txtSubmitted; 19 20 protected sample031 MyCustomControl ; 16 protected System.Web.UI.WebControls.DropDownList cmbToolbars; 17 protected FredCK.FCKeditorV2.FCKeditor FCKeditor1; 18 protected System.Web.UI.WebControls.Button BtnSubmit; 19 protected System.Web.UI.WebControls.Label LblPostedData; 20 protected System.Web.UI.HtmlControls.HtmlGenericControl PostedAlertBlock; 21 protected System.Web.UI.HtmlControls.HtmlGenericControl PostedDataBlock; 21 22 22 23 private void Page_Load(object sender, System.EventArgs e) 23 24 { 24 // We'll do initializartion only the first time. 25 // Once the page is submitted, nothing must be done in the OnLoad. 25 // Set the base path. This is the URL path for the FCKeditor 26 // installations. By default "/fckeditor/". 27 FCKeditor1.BasePath = this.GetBasePath(); 28 29 LblPostedData.Text = ""; 30 PostedAlertBlock.Visible = false; 31 PostedDataBlock.Visible = false; 32 26 33 if ( Page.IsPostBack ) 27 return ;34 return; 28 35 29 eSubmittedDataBlock.Visible = false ; 36 // Set the startup editor value. 37 FCKeditor1.Value = "<p>This is some <strong>sample text</strong>. You are using <a href=\"http://www.fckeditor.net/\">FCKeditor</a>.</p>"; 30 38 } 31 39 … … 38 46 InitializeComponent(); 39 47 base.OnInit(e); 40 41 // This events declarations has been moved to the "OnInit" method42 // to avoid a bug in Visual Studio to delete then without any advice.43 this.Load += new System.EventHandler(this.Page_Load);44 this.btnSubmit.ServerClick += new System.EventHandler(this.btnSubmit_ServerClick);45 48 } 46 49 … … 51 54 private void InitializeComponent() 52 55 { 56 this.Load += new System.EventHandler(this.Page_Load); 57 53 58 } 54 59 #endregion