initial commit
[namibia] / public / scripts / ckeditor / _samples / readonly.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <!--
3 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
4 For licensing, see LICENSE.html or http://ckeditor.com/license
5 -->
6 <html xmlns="http://www.w3.org/1999/xhtml">
7 <head>
8         <title>Read-only State &mdash; CKEditor Sample</title>
9         <meta content="text/html; charset=utf-8" http-equiv="content-type" />
10         <script type="text/javascript" src="../ckeditor.js"></script>
11         <script src="sample.js" type="text/javascript"></script>
12         <link href="sample.css" rel="stylesheet" type="text/css" />
13         <script type="text/javascript">
14         //<![CDATA[
15
16 var editor;
17
18 // The instanceReady event is fired, when an instance of CKEditor has finished
19 // its initialization.
20 CKEDITOR.on( 'instanceReady', function( ev )
21         {
22                 editor = ev.editor;
23
24                 // Show this "on" button.
25                 document.getElementById( 'readOnlyOn' ).style.display = '';
26
27                 // Event fired when the readOnly property changes.
28                 editor.on( 'readOnly', function()
29                         {
30                                 document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
31                                 document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
32                         });
33         });
34
35 function toggleReadOnly( isReadOnly )
36 {
37         // Change the read-only state of the editor.
38         // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly
39         editor.setReadOnly( isReadOnly );
40 }
41
42         //]]>
43         </script>
44
45 </head>
46 <body>
47         <h1 class="samples">
48                 CKEditor Sample &mdash; Using the CKEditor Read-Only API
49         </h1>
50         <div class="description">
51         <p>
52                 This sample shows how to use the
53                 <code><a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly">setReadOnly</a></code>
54                 API to put editor into the read-only state that makes it impossible for users to change the editor contents.
55         </p>
56         <p>
57                 For details on how to create this setup check the source code of this sample page.
58         </p>
59         </div>
60
61         <!-- This <div> holds alert messages to be display in the sample page. -->
62         <div id="alerts">
63                 <noscript>
64                         <p>
65                                 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
66                                 support, like yours, you should still see the contents (HTML data) and you should
67                                 be able to edit it normally, without a rich editor interface.
68                         </p>
69                 </noscript>
70         </div>
71         <form action="sample_posteddata.php" method="post">
72                 <p>
73                         <textarea class="ckeditor" id="editor1" name="editor1" cols="100" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
74                 </p>
75                 <p>
76                         <input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none" />
77                         <input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none" />
78                 </p>
79         </form>
80         <div id="footer">
81                 <hr />
82                 <p>
83                         CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
84                 </p>
85                 <p id="copy">
86                         Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
87                         Knabben. All rights reserved.
88                 </p>
89         </div>
90 </body>
91 </html>