source: branches/unified_backend/examples/full_example-body.php @ 121

Last change on this file since 121 was 121, checked in by yermol, 14 years ago

htmlarea.js

. more debugging messages added.
. added HTMLArea.Config.linkReplacementMode which can be either

fullyqualified (the old default behavior) or absolute.


When set to fullyqualified all absolute links (e.g. /somepath) will be changed to fullyqualified URLS (e.g. http://yoursite/somepth).


When set to absolute, all fullyqualified urls back to the current site
will be changed to absolute (e.g. httpyoursite/somepath to /somepath)
making the Xinha generated content portable between sites.


( see HTMLArea.prototype.outwardHtml() )


. bugfix - if plugin .js file has a parse error htmlarea will only try to load

it a configurable number of times before popping up an error message.


backends/backend.php

. initial unified backend created. Requests to this backend are routed

to the corresponding plugin specific backend.php file.


backends/backend_conf.php

. a central server side configuration file has been created for the use

of plugin serverside code.

. all backends hooked into this scheme must include the central config file.

ImageManager?

. modified the config to allow overriding default values.
. default image directory is now xinha/examples/images
. added debugging trace messages which are tagged with the ImageManager? name.
. now uses unified backend.

Linker

. includes central config.
. default directory is now the xinha/examples directory (to avoid scan.php security

problem)

. added debugging trace messages which are tagged with the Linker name.
. links selected from the tree are now displayed in absolute instead of fully qualified

fashion.

. on edit the link that was previously selected is highlighted.
. on edit the selected link is scrolled to if it's outside the viewable area.
. if scan.php returns some kind of error or invalid javascript Linker now pops up

a nice descriptive error message.


. bugfix - same pattern as in loading plugins. If there is some error in loading the directory listing Linker will only attempt it a few times before giving up and

displaying a nice error.


dTree.js

. added clear_s() method to clear the selection
. added getNodeElement() method to return the <a ..> element for a given node.

  • Property svn:eol-style set to native
  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 9.1 KB
Line 
1<?php
2
3// [NOSTRIP
4// -----------------------------------------------------------------
5// Copyright (C) Gogo Code.
6// http://code.gogo.co.nz
7//
8// Unified backend modifications by DTLink, LLC.
9// http://www.dtlink.com and http://www.formvista.com
10// -----------------------------------------------------------------
11// This code is distributed under the the sames terms as Xinha
12// itself. (HTMLArea license based on the BSD license)
13//
14// Please read license.txt in this package for details.
15//
16// All software distributed under the Licenses is provided strictly on
17// an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
18// IMPLIED, AND DTLINK LLC HEREBY DISCLAIMS ALL SUCH
19// WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
20// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT,
21// OR NON-INFRINGEMENT.
22// ------------------------------------------------------------------
23// NOSTRIP]
24
25/**
26* Modified version of full_example-body.html for use with the PHP unified backend.
27*
28* To use the unified backend you must first include the backend_conf.php file which
29* is generated by Configure.php.
30*/
31
32/**
33* Configure.php generated config file for PHP unified backend.
34*/
35
36include_once( "../backends/backend_conf.php" );
37
38?><html>
39<head>
40
41  <!--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
42    --  Xinha example usage.  This file shows how a developer might make use of
43    --  Xinha, it forms the primary example file for the entire Xinha project.
44    --  This file can be copied and used as a template for development by the
45    --  end developer who should simply removed the area indicated at the bottom
46    --  of the file to remove the auto-example-generating code and allow for the
47    --  use of the file as a boilerplate.
48    --
49    --  $HeadURL$
50    --  $LastChangedDate$
51    --  $LastChangedRevision$
52    --  $LastChangedBy$
53    --------------------------------------------------------------------------->
54
55  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
56  <title>Example of Xinha</title>
57  <link rel="stylesheet" href="<? echo XINHA_INSTALL_URL; ?>/examples/full_example.css" />
58
59  <script type="text/javascript">
60    // You must set _editor_url to the URL (including trailing slash) where Xinha
61         // is installed.
62         //
63         // Before we had the central config, this is the way it was done.
64         //
65    // _editor_url  = document.location.href.replace(/examples\/full_example-body\.html.*/, '')
66
67    _editor_url  = "<? echo XINHA_INSTALL_URL; ?>";
68    _editor_lang = "en";      // And the language we need to use in the editor.
69  </script>
70
71  <!--  load in debug trace message class -->
72
73  <script type="text/javascript" src="<? echo XINHA_INSTALL_URL; ?>/ddt/ddt.js"></script>
74
75  <!-- create a global trace message object -->
76
77  <script type="text/javascript">
78   var startupDDT = new DDT( "startup" );
79   startupDDT._ddtOn();
80
81        startupDDT._ddt( "full_example-body.php", "81", "ddt object created on calling page" );
82  </script>
83 
84  <!-- Load up the actual editor core -->
85  <script type="text/javascript" src="<? echo XINHA_INSTALL_URL; ?>/htmlarea.js"></script>
86
87  <script type="text/javascript">
88    xinha_editors = null;
89    xinha_init    = null;
90    xinha_config  = null;
91    xinha_plugins = null;
92
93    // This contains the names of textareas we will make into Xinha editors
94    xinha_init = xinha_init ? xinha_init : function()
95    {
96      /** STEP 1 ***************************************************************
97       * First, what are the plugins you will be using in the editors on this
98       * page.  List all the plugins you will need, even if not all the editors
99       * will use all the plugins.
100       ************************************************************************/
101
102      xinha_plugins = xinha_plugins ? xinha_plugins :
103      [
104       'CharacterMap',
105       'ContextMenu',
106       'FullScreen',
107       'ListType',
108       'SpellChecker',
109       'Stylist',
110       'SuperClean',
111       'TableOperations'
112      ];
113
114                // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
115                if (!HTMLArea.loadPlugins(xinha_plugins, xinha_init))
116                        return;
117
118      /** STEP 2 ***************************************************************
119       * Now, what are the names of the textareas you will be turning into
120       * editors?
121       ************************************************************************/
122
123      xinha_editors = xinha_editors ? xinha_editors :
124      [
125        'myTextArea',
126        'anotherOne'
127      ];
128
129      /** STEP 3 ***************************************************************
130       * We create a default configuration to be used by all the editors.
131       * If you wish to configure some of the editors differently this will be
132       * done in step 4.
133       *
134       * If you want to modify the default config you might do something like this.
135       *
136       *   xinha_config = new HTMLArea.Config();
137       *   xinha_config.width  = 640;
138       *   xinha_config.height = 420;
139       *
140       *************************************************************************/
141
142       xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();
143
144      /** STEP 3 ***************************************************************
145       * We first create editors for the textareas.
146       *
147       * You can do this in two ways, either
148       *
149       *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
150       *
151       * if you want all the editor objects to use the same set of plugins, OR;
152       *
153       *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
154       *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
155       *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
156       *
157       * if you want to use a different set of plugins for one or more of the
158       * editors.
159       ************************************************************************/
160
161      xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
162
163      /** STEP 4 ***************************************************************
164       * If you want to change the configuration variables of any of the
165       * editors,  this is the place to do that, for example you might want to
166       * change the width and height of one of the editors, like this...
167       *
168       *   xinha_editors.myTextArea.config.width  = 640;
169       *   xinha_editors.myTextArea.config.height = 480;
170       *
171       ************************************************************************/
172
173
174      /** STEP 5 ***************************************************************
175       * Finally we "start" the editors, this turns the textareas into
176       * Xinha editors.
177       ************************************************************************/
178
179      HTMLArea.startEditors(xinha_editors);
180    }
181
182    window.onload = xinha_init;
183  </script>
184</head>
185
186<body onload="xinha_init()">
187
188  <form id="editors_here">
189    <textarea id="myTextArea" name="myTextArea" rows="10" cols="80" style="width:100%"></textarea>
190    <textarea id="anotherOne" name="anotherOne" rows="10" cols="80" style="width:100%"></textarea>
191  </form>
192
193
194  <!----------------------------------------------------------------------------
195    -                            !! IMPORTANT !!
196    -  The html and javascript below is the code used to create the example page.
197    -  It renders a lot of the above unused because it pre-fills xinha_editors,
198    -  xinha_config and xinha_plugins for you, and creates new textareas in place
199    -  of the ones above. The items above are not used while the example is being
200    -  used!
201    -
202    -  If you are going to take the code in this file to form the basis of your
203    -  own, then leave out this marked area.
204    --------------------------------------------------------------------------->
205
206        <div id="lipsum" style="display:none">
207          <p>This is an example of a Xinha editor with extensive trace messages
208                         turned on. To turn off trace messages, assuming you have the source, just
209                         comment out the _ddtOn() calls. Eventually we'll have a script that
210                         strips out the trace messages and comments to produce a "runtime' version.</p>
211
212          <p>This branch of Xinha development is called the Unified
213                         Backend branch. It includes a number of changes over the
214                         trunk<p>
215
216          <ul>
217            <li> JSDoc documentation headers on all functions (partially complete)  </li>
218            <li> _ddt() debugging trace messages added to most methods. </li>
219            <li> svn_commit.php front end to svn commit. </li>
220            <li> Configure.php script to generate server side scripts and permissions. </li>
221            <li> makedocs.pl script to generate documentation.</li>
222                                <li> unified PHP backend script in backends/backend.php through which all
223                                                plugin to server communications are routed (ImageManager and Linker are
224                                                done, SpellChecker is next).
225          </ul>
226
227                         <p>For more information see the README.txt and README_DEVELOPERS.txt
228                         file from the Xinha_ub branch.</p>
229        </div>
230        <script src="full_example.js"></script>
231
232  <!--------------------------------------------------------------------------->
233
234
235</body>
236</html>
Note: See TracBrowser for help on using the repository browser.