source: trunk/examples/testbed.php

Last change on this file was 1409, checked in by gogo, 18 months ago
File size: 5.5 KB
Line 
1<?php require_once('require-password.php'); ?>
2<?php
3  switch(@$_REQUEST['DocType'])
4  {
5   
6    case 'quirks':
7      break;
8     
9   case 'almost':
10      echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
11      break;
12   
13    case 'standards':
14    default:
15      echo '<!DOCTYPE html>';
16      break;
17     
18  }
19?>
20<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
21<head>
22
23  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
24  <title>Example of Xinha</title>
25  <link rel="stylesheet" href="files/full_example.css" />
26
27  <script src="../XinhaEasy.js" type="text/javascript">
28   
29    // The following options are, optional...
30    xinha_options =
31    {
32      // Specify language and skin
33      _editor_lang:   'en',         // Language to use
34      _editor_skin:   'silva',      // Name of the skin to use (see skins directory for available skins)
35     
36      // Simply a CSS selector to pick the textarea(s) you want, eg 'textarea' converts all textarea,
37      // or textarea.my-xinha,textarea.your-xinha would convert only those textareas with the
38      // my-xinha or your-xinha classes on them
39      xinha_editors:  'textarea',   
40
41      // Plugins can be one of the simple pre-defined sets, common, minimal and loaded
42      //   xinha_plugins: 'minimal'
43      //
44      // or you can specify the plugins you want exactly
45      //   xinha_plugins: [ 'Linker', 'Stylist' ]
46      //
47      // or you can do both to add extras to the set
48      //   xinha_pass_to_php_backend: ['minimal', 'Linker' ]
49      xinha_plugins:  [ 'common', 'MootoolsFileManager', 'Linker' ],
50     
51      // Toolbar can be one of the pre-defined toolbars, 'default', 'minimal', 'minimal+fonts'
52      //   xinha_toolbar: 'minimal+fonts'
53      //
54      // or you an specify a toolbar structure completely
55      //   xinha_toolbar: [ ["popupeditor"],["separator","bold","italic","underline","strikethrough","superscript"] ]
56      xinha_toolbar:  'minimal+fonts',
57     
58      // This is where you set the default configuration which apply globally
59      xinha_config:            function(xinha_config)
60      {
61        xinha_config.CharacterMap.mode = 'panel';
62        xinha_config.ContextMenu.customHooks = { 'a': [ ['Label', function() { alert('Action'); }, 'Tooltip', '/xinha/images/ed_copy.gif' ] ] }
63       
64        /*
65          // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL
66          //  otherwise it won't work!
67          xinha_config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.html/, 'files/stylist.css'));
68
69          // Or we can load styles directly
70          xinha_config.stylistLoadStyles('p.red_text { color:red }');
71
72          // If you want to provide "friendly" names you can do so like
73          // (you can do this for stylistLoadStylesheet as well)
74          xinha_config.stylistLoadStyles('p.pink_text { color:pink }', {'p.pink_text' : 'Pretty Pink'});
75       */
76
77        // Configure the File Manager
78        with (xinha_config.MootoolsFileManager)
79        {
80          <?php
81            require_once('../contrib/php-xinha.php');
82            xinha_pass_to_php_backend
83            (       
84              array
85              (
86                'images_dir' => getcwd() . '/images',
87                'images_url' => preg_replace('/\/examples.*/', '', $_SERVER['REQUEST_URI']) . '/examples/images',
88                'images_allow_upload' => true,
89                'images_allow_delete' => true,
90                'images_allow_download' => true,
91                'images_use_hspace_vspace' => false,
92               
93                'files_dir' => getcwd() . '/images',
94                'files_url' => preg_replace('/\/examples.*/', '', $_SERVER['REQUEST_URI']) . '/examples/images',
95                'files_allow_upload' => true,
96                'max_files_upload_size' => '4M',
97              )
98            )
99          ?>
100        }
101     
102        // Configure the Linker
103        with (xinha_config.Linker)
104        {
105          <?php
106            require_once('../contrib/php-xinha.php');
107            xinha_pass_to_php_backend
108            (       
109              array
110              (
111                'dir' => getcwd(),
112                'url' => '/examples',               
113              )
114            )
115          ?>
116        }
117       
118      }
119    }
120
121  </script>
122 
123</head>
124
125<body>
126 
127  <form action="javascript:void(0);" id="editors_here" onsubmit="alert(this.myTextArea.value);">
128     <div>
129    <textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px;">
130&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
131Aliquam et tellus vitae justo varius placerat. Suspendisse iaculis
132velit semper dolor. Donec gravida tincidunt mi. Curabitur tristique
133ante elementum turpis. Aliquam nisl. Nulla posuere neque non
134tellus. Morbi vel nibh. Cum sociis natoque penatibus et magnis dis
135parturient montes, nascetur ridiculus mus. Nam nec wisi. In wisi.
136Curabitur pharetra bibendum lectus.&lt;/p&gt;
137</textarea>
138    <input type="submit" /> <input type="reset" />
139    </div>
140  </form>
141
142  <ul>
143    <li><a href="<?php echo basename(__FILE__) ?>?DocType=standards">Test Standards Mode</a></li>
144    <li><a href="<?php echo basename(__FILE__) ?>?DocType=almost">Test Almost Standards Mode</a></li>
145    <li><a href="<?php echo basename(__FILE__) ?>?DocType=quirks">Test Quirks Mode</a></li>
146  </ul>
147 
148  <!-- This script is used to show the rendering mode (Quirks, Standards, Almost Standards) -->
149  <script type="text/javascript" src="render-mode-developer-help.js"></script>
150</body>
151</html>
Note: See TracBrowser for help on using the repository browser.