source: trunk/examples/ext_example-menu.php @ 328

Last change on this file since 328 was 328, checked in by gocher, 14 years ago

Ticket #503
Language translation problems when replacing string
"Insert a submit/reset button."

File size: 9.0 KB
Line 
1<?PHP
2  $LocalPluginPath = dirname(dirname(__FILE__)).'\plugins';
3  $LocalSkinPath = dirname(dirname(__File__)).'\skins';
4?> 
5<html>
6<head>
7
8  <!--------------------------------------:noTabs=true:tabSize=2:indentSize=2:--
9    --  Xinha example menu.  This file is used by full_example.html within a
10    --  frame to provide a menu for generating example editors using
11    --  full_example-body.html, and full_example.js.
12    --
13    --  $HeadURL$
14    --  $LastChangedDate$
15    --  $LastChangedRevision$
16    --  $LastChangedBy$
17    --------------------------------------------------------------------------->
18
19  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
20  <title>Example of Xinha</title>
21  <link rel="stylesheet" href="full_example.css" />
22  <style type="text/css">
23    h1 {font: bold 22px "Staccato222 BT", cursive;}
24    form, p {margin: 0px; padding: 0px;}
25    label { display:block;}
26  </style>
27  <script language="JavaScript" type="text/javascript">
28  function _onResize() {
29    var sHeight;
30    if (window.innerHeight) sHeight = window.innerHeight;
31    else if (document.body && document.body.offsetHeight) sHeight = document.body.offsetHeight;
32    else return;
33    if (sHeight>270) {
34      sHeight = sHeight - 245;
35    } else {
36      sHeight = 30
37    } 
38    var div = document.getElementById("div_plugins");
39    div.style.height = sHeight + "px";
40  }
41 
42function Dialog(url, action, init) {
43        if (typeof init == "undefined") {
44                init = window;  // pass this window object by default
45        }
46        Dialog._geckoOpenModal(url, action, init);
47};
48
49Dialog._parentEvent = function(ev) {
50        setTimeout( function() { if (Dialog._modal && !Dialog._modal.closed) { Dialog._modal.focus() } }, 50);
51        if (Dialog._modal && !Dialog._modal.closed) {
52                agt = navigator.userAgent.toLowerCase();
53                is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
54                if (is_ie) {
55                        ev.cancelBubble = true;
56                        ev.returnValue = false;
57                } else {
58                        ev.preventDefault();
59                        ev.stopPropagation();
60                }
61        }
62};
63
64
65// should be a function, the return handler of the currently opened dialog.
66Dialog._return = null;
67
68// constant, the currently opened dialog
69Dialog._modal = null;
70
71// the dialog will read it's args from this variable
72Dialog._arguments = null;
73
74Dialog._geckoOpenModal = function(url, action, init) {
75        var dlg = window.open(url, "hadialog",
76                              "toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
77                              "scrollbars=no,resizable=yes,modal=yes,dependable=yes");
78        Dialog._modal = dlg;
79        Dialog._arguments = init;
80
81        // capture some window's events
82        function capwin(w) {
83//              HTMLArea._addEvent(w, "click", Dialog._parentEvent);
84//              HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent);
85//              HTMLArea._addEvent(w, "focus", Dialog._parentEvent);
86        };
87        // release the captured events
88        function relwin(w) {
89//              HTMLArea._removeEvent(w, "click", Dialog._parentEvent);
90//              HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent);
91//              HTMLArea._removeEvent(w, "focus", Dialog._parentEvent);
92        };
93        capwin(window);
94        // capture other frames
95        for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
96        // make up a function to be called when the Dialog ends.
97        Dialog._return = function (val) {
98                if (val && action) {
99                        action(val);
100                }
101                relwin(window);
102                // capture other frames
103                for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
104                Dialog._modal = null;
105        };
106};
107
108  function fExtended () {
109        var outparam = { width: document.getElementById("width").value,
110                     height: document.getElementById("height").value,
111                     sizeIncludesBars: document.getElementById("sizeIncludesBars").value,
112                     statusBar: document.getElementById("statusBar").value,
113                     mozParaHandler: document.getElementById("mozParaHandler").value,
114                     undoSteps: document.getElementById("undoSteps").value,
115                     baseHref: document.getElementById("baseHref").value,
116                     stripBaseHref: document.getElementById("stripBaseHref").value,
117                     stripSelfNamedAnchors: document.getElementById("stripSelfNamedAnchors").value,
118                     only7BitPrintablesInURLs: document.getElementById("only7BitPrintablesInURLs").value,
119                     sevenBitClean: document.getElementById("sevenBitClean").value,
120                     killWordOnPaste: document.getElementById("killWordOnPaste").value,
121                     flowToolbars: document.getElementById("flowToolbars").value,
122                     CharacterMapMode: document.getElementById("CharacterMapMode").value,
123                     ListTypeMode: document.getElementById("ListTypeMode").value
124                   };
125          Dialog("Extended.html", function(param) {
126      if(param) {
127                    document.getElementById("width").value = param["width"];
128                    document.getElementById("height").value = param["height"];
129        document.getElementById("sizeIncludesBars").value = param["sizeIncludesBars"];
130        document.getElementById("statusBar").value = param["statusBar"];
131        document.getElementById("mozParaHandler").value = param["mozParaHandler"];
132        document.getElementById("undoSteps").value = param["undoSteps"];
133        document.getElementById("baseHref").value = param["baseHref"];
134        document.getElementById("stripBaseHref").value = param["stripBaseHref"];
135        document.getElementById("stripSelfNamedAnchors").value = param["stripSelfNamedAnchors"];
136        document.getElementById("only7BitPrintablesInURLs").value = param["only7BitPrintablesInURLs"];
137        document.getElementById("sevenBitClean").value = param["sevenBitClean"];
138        document.getElementById("killWordOnPaste").value = param["killWordOnPaste"];
139        document.getElementById("flowToolbars").value = param["flowToolbars"];
140                document.getElementById("CharacterMapMode").value = param["CharacterMapMode"];
141        document.getElementById("ListTypeMode").value = param["ListTypeMode"];
142                  }
143                }, outparam );
144  }
145
146  window.onresize = _onResize;
147  window.onload = _onResize;
148  </script>
149</head>
150
151<body>
152  <form action="ext_example-body.html" target="body">
153  <h1>Xinha Example</h1>
154    <fieldset>
155      <legend>Settings</legend>
156        <label>
157          Number of Editors: <input type="text" name="num" value="1" style="width:25;" maxlength="2"/>
158        </label>
159        <label>
160          Language:
161          <select name="lang">
162          <option value="en">English</option>
163          <option value="de">German</option>
164          <option value="fr">French</option>
165          <option value="it">Italian</option>
166          <option value="no">Norwegian</option>
167          <option value="pl">Polish</option>
168          </select>
169        </label>
170        <label>
171          Skin:
172          <select name="skin">
173          <option value="">-- no skin --</option>
174<?php
175        $d = @dir($LocalSkinPath);
176        while (false !== ($entry = $d->read()))  //not a dot file or directory
177        {       if(substr($entry,0,1) != '.')
178                { echo '<option value="' . $entry . '"> ' . $entry . '</option>';
179                }
180        }
181        $d->close();
182?>
183          </select>
184        </label>
185        <input type="hidden" id="width" name="width" value="auto" />
186        <input type="hidden" id="height" name="height" value="auto" />
187        <input type="hidden" id="sizeIncludesBars" name="sizeIncludeBars" value="true" />
188        <input type="hidden" id="statusBar" name="statusBar" value="true" />
189        <input type="hidden" id="mozParaHandler" name="mozParaHandler" value="best" />
190        <input type="hidden" id="undoSteps" name="undoSteps" value="20" />
191        <input type="hidden" id="baseHref" name="baseHref" value="null" />
192        <input type="hidden" id="stripBaseHref" name="stripBaseHref" value="true" />
193        <input type="hidden" id="stripSelfNamedAnchors" name="stripSelfNamedAnchors" value="true" />
194        <input type="hidden" id="only7BitPrintablesInURLs" name="only7BitPrintablesInURLs" value="true" />
195        <input type="hidden" id="sevenBitClean" name="sevenBitClean" value="false" />
196        <input type="hidden" id="killWordOnPaste" name="killWordOnPaste" value="true" />
197        <input type="hidden" id="flowToolbars" name="flowToolbars" value="true" />
198        <input type="hidden" id="CharacterMapMode" name="CharacterMapMode" value="popup" />
199        <input type="hidden" id="ListTypeMode" name="ListTypeMode" value="toolbar" />
200        <center><input type="button" value="extended Settings" onClick="fExtended();" /></center>
201
202    </fieldset>
203    <fieldset>
204      <legend>Plugins</legend>
205      <div id="div_plugins" style="width:100%; overflow:auto">
206<?php
207        $d = @dir($LocalPluginPath);
208        while (false !== ($entry = $d->read()))  //not a dot file or directory
209        {       if(substr($entry,0,1) != '.')
210                { echo '<label><input type="checkbox" name="plugins" value="' . $entry . '"> ' . $entry . '</label>';
211                }
212        }
213        $d->close();
214?>
215      </div>
216    </fieldset>
217    <center><input type="submit" value="reload editor"></center>
218  </form>
219  <script type="text/javascript">
220    top.frames["body"].location.href = document.location.href.replace(/ext_example-menu\.php.*/, 'ext_example-body.html')
221  </script>
222
223</body>
224</html>
Note: See TracBrowser for help on using the repository browser.