Ticket #800: example.html

File example.html, 7.6 kB (added by the_therapist, 6 years ago)

The page with the textarea on it so you can see the config. I deleted style elements and other unrelated stuff.

Line 
1<?php
2if (isset($_POST['message'])) {
3$working = $_POST['working'];
4$message = $_POST['message'];
5
6$writeme=fopen("$working","w");
7fputs($writeme, stripslashes($message));
8fclose($writeme);
9
10header("Location: /content/index.php");
11}
12?>
13<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
14<head>
15<style type="text/css" title="Default" media="all">@import "/c/admin.css";</style>
16
17  <!--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
18    --  Xinha example usage.  This file shows how a developer might make use of
19    --  Xinha, it forms the primary example file for the entire Xinha project.
20    --  This file can be copied and used as a template for development by the
21    --  end developer who should simply removed the area indicated at the bottom
22    --  of the file to remove the auto-example-generating code and allow for the
23    --  use of the file as a boilerplate.
24    --
25    --  $HeadURL: http://svn.xinha.python-hosting.com/trunk/examples/full_example-body.html $
26    --  $LastChangedDate: 2005-07-28 02:43:19 +1200 (Thu, 28 Jul 2005) $
27    --  $LastChangedRevision: 287 $
28    --  $LastChangedBy: gocher $
29    --------------------------------------------------------------------------->
30
31  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
32 
33
34  <script type="text/javascript">
35    // You must set _editor_url to the URL (including trailing slash) where
36    // where xinha is installed, it's highly recommended to use an absolute URL
37    //  eg: _editor_url = "/path/to/xinha/";
38    // You may try a relative URL if you wish]
39    //  eg: _editor_url = "../";
40    // in this example we do a little regular expression to find the absolute path.
41    _editor_url  = "/js/xinha/";
42    _editor_lang = "en";      // And the language we need to use in the editor.
43  </script>
44
45  <!-- Load up the actual editor core -->
46  <script type="text/javascript" src="/js/xinha/htmlarea.js"></script>
47
48  <script type="text/javascript">
49    xinha_editors = null;
50    xinha_init    = null;
51    xinha_config  = null;
52    xinha_plugins = null;
53
54    // This contains the names of textareas we will make into Xinha editors
55    xinha_init = xinha_init ? xinha_init : function()
56    {
57      /** STEP 1 ***************************************************************
58       * First, what are the plugins you will be using in the editors on this
59       * page.  List all the plugins you will need, even if not all the editors
60       * will use all the plugins.
61       ************************************************************************/
62
63      xinha_plugins = xinha_plugins ? xinha_plugins :
64      [
65       'CharacterMap',
66       'ContextMenu',
67       'FullScreen',
68       'ListType',
69       'SpellChecker',
70       'Stylist',
71       'SuperClean',
72       'TableOperations',
73           'ImageManager',
74           'CSS'
75           
76      ];
77
78             // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
79             if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;
80
81      /** STEP 2 ***************************************************************
82       * Now, what are the names of the textareas you will be turning into
83       * editors?
84       ************************************************************************/
85
86      xinha_editors = xinha_editors ? xinha_editors :
87      [
88        'myTextArea',
89      ];
90
91      /** STEP 3 ***************************************************************
92       * We create a default configuration to be used by all the editors.
93       * If you wish to configure some of the editors differently this will be
94       * done in step 5.
95       *
96       * If you want to modify the default config you might do something like this.
97       *
98       *   xinha_config = new HTMLArea.Config();
99       *   xinha_config.width  = '640px';
100       *   xinha_config.height = '420px';
101       *
102       *************************************************************************/
103
104       xinha_config = xinha_config ? xinha_config() : new HTMLArea.Config();
105           
106
107      /** STEP 4 ***************************************************************
108       * We first create editors for the textareas.
109       *
110       * You can do this in two ways, either
111       *
112       *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
113       *
114       * if you want all the editor objects to use the same set of plugins, OR;
115       *
116       *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
117       *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
118       *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
119       *
120       * if you want to use a different set of plugins for one or more of the
121       * editors.
122       ************************************************************************/
123      xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
124
125      /** STEP 5 ***************************************************************
126       * If you want to change the configuration variables of any of the
127       * editors,  this is the place to do that, for example you might want to
128       * change the width and height of one of the editors, like this...
129       *
130       *   xinha_editors.myTextArea.config.width  = '640px';
131       *   xinha_editors.myTextArea.config.height = '480px';
132       *
133       ************************************************************************/
134
135
136      /** STEP 6 ***************************************************************
137       * Finally we "start" the editors, this turns the textareas into
138       * Xinha editors.
139       ************************************************************************/
140
141      HTMLArea.startEditors(xinha_editors);
142    }
143
144    window.onload = xinha_init;
145
146// No idea how to apply current css styles or use Stylist plugin       
147        /*    if(typeof CSS != 'undefined')
148    {
149      config.pageStyle = "@import url(/c/main.css);";
150    }*/
151       
152    if(typeof Stylist != 'undefined')
153    {
154      // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL
155      //  otherwise it won't work!
156      config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.html/, 'stylist.css'));
157
158      // Or we can load styles directly
159      config.stylistLoadStyles('p.red_text { color:red }');
160    }
161  </script>
162  <link type="text/css" rel="stylesheet" title="blue-look" href="/js/xinha/skins/blue-look/skin.css" /> <!--
163  <link type="text/css" rel="alternate stylesheet" title="green-look" href="../skins/green-look/skin.css" />
164  <link type="text/css" rel="alternate stylesheet" title="xp-blue" href="../skins/xp-blue/skin.css" />
165  <link type="text/css" rel="alternate stylesheet" title="xp-green" href="../skins/xp-green/skin.css" />
166  <link type="text/css" rel="alternate stylesheet" title="inditreuse" href="../skins/inditreuse/skin.css" />
167  <link type="text/css" rel="alternate stylesheet" title="blue-metallic" href="../skins/blue-metallic/skin.css" /-->
168</head>
169<body>
170  <form id="editors_here" method="post" action="file:///Z|/sites/coa/www/content/foo.php">
171    <textarea id="myTextArea" name="message" rows="10" cols="90" style="width:99%;">
172<?php
173$s=file($working);
174for ($i=0; $i<sizeof($s);$i++){
175   // echo htmlentities($s[$i]);
176        echo $s[$i];
177}
178?>
179</textarea>
180<input type="hidden" value="<?php echo $working; ?>" name="working"><br />
181<input type="submit" value="Submit Changes">
182        <input style="margin-left: 500px;" type="button" value="Cancel" onclick="history.go(-1); return false;">
183  </form>
184
185
186</body>
187</html>