source: trunk/examples/Extended.html @ 353

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

Ticket #480 (requires PHP!!!)
PHP example-menu list all folders in the plugin path as plugins and all folders in skin path as skins!
Further in this example: there is a dialog settings for (Editor width, Editor height, Size includes bars, Status Bar, Mozilla Parameter Handler, Udo steps, Base href, Strip base href, ...)

File size: 8.0 KB
Line 
1<html>
2
3<head>
4  <title>Settings</title>
5  <link rel="stylesheet" type="text/css" href="../popups/popup.css" />
6  <script type="text/javascript">
7
8function getAbsolutePos(el) {
9        var r = { x: el.offsetLeft, y: el.offsetTop };
10        if (el.offsetParent) {
11                var tmp = getAbsolutePos(el.offsetParent);
12                r.x += tmp.x;
13                r.y += tmp.y;
14        }
15        return r;
16};
17
18function comboSelectValue(c, val) {
19        var ops = c.getElementsByTagName("option");
20        for (var i = ops.length; --i >= 0;) {
21                var op = ops[i];
22                op.selected = (op.value == val);
23        }
24        c.value = val;
25};
26
27function __dlg_onclose() {
28        opener.Dialog._return(null);
29};
30
31// closes the dialog and passes the return info upper.
32function __dlg_close(val) {
33        opener.Dialog._return(val);
34        window.close();
35};
36
37function __dlg_close_on_esc(ev) {
38        ev || (ev = window.event);
39        if (ev.keyCode == 27) {
40                window.close();
41                return false;
42        }
43        return true;
44};
45
46function __dlg_init(bottom) {
47  var body = document.body;
48        var body_height = 0;
49        if (typeof bottom == "undefined") {
50                var div = document.createElement("div");
51                body.appendChild(div);
52                var pos = getAbsolutePos(div);
53                body_height = pos.y;
54        } else {
55                var pos = getAbsolutePos(bottom);
56                body_height = pos.y + bottom.offsetHeight;
57        }
58        window.dialogArguments = opener.Dialog._arguments;
59        if (!document.all) {
60                window.sizeToContent();
61                window.sizeToContent(); // for reasons beyond understanding,
62                                        // only if we call it twice we get the
63                                        // correct size.
64                window.addEventListener("unload", __dlg_onclose, true);
65                window.innerWidth = body.offsetWidth + 5;
66                window.innerHeight = body_height + 2;
67                // center on parent
68                var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
69                var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
70                window.moveTo(x, y);
71        } else {
72                // window.dialogHeight = body.offsetHeight + 50 + "px";
73                // window.dialogWidth = body.offsetWidth + "px";
74                window.resizeTo(body.offsetWidth, body_height);
75                var ch = body.clientHeight;
76                var cw = body.clientWidth;
77                window.resizeBy(body.offsetWidth - cw, body_height - ch);
78                var W = body.offsetWidth;
79                var H = 2 * body_height - ch;
80                var x = (screen.availWidth - W) / 2;
81                var y = (screen.availHeight - H) / 2;
82                window.moveTo(x, y);
83        }
84        document.body.onkeypress = __dlg_close_on_esc;
85};
86
87function Init() {
88  __dlg_init();
89  var param = window.dialogArguments;
90  if (param) {
91    document.getElementById("width").value = param["width"];
92    document.getElementById("height").value = param["height"];
93    document.getElementById("sizeIncludesBars").checked = (param["sizeIncludesBars"] == 'true');
94    document.getElementById("statusBar").checked = (param["statusBar"] == 'true');
95    document.getElementById("mozParaHandler").value = param["mozParaHandler"];
96    document.getElementById("undoSteps").value = param["undoSteps"];
97    document.getElementById("baseHref").value = param["baseHref"];
98    document.getElementById("stripBaseHref").checked = (param["stripBaseHref"] == 'true');
99    document.getElementById("stripSelfNamedAnchors").checked = (param["stripSelfNamedAnchors"] == 'true');
100    document.getElementById("only7BitPrintablesInURLs").checked = (param["only7BitPrintablesInURLs"] == 'true');
101    document.getElementById("sevenBitClean").checked = (param["sevenBitClean"] == 'true');
102    document.getElementById("killWordOnPaste").checked = (param["killWordOnPaste"] == 'true');
103                document.getElementById("flowToolbars").checked = (param["flowToolbars"] == 'true');
104                document.getElementById("CharacterMapMode").value = param["CharacterMapMode"];
105    document.getElementById("ListTypeMode").value = param["ListTypeMode"];
106   
107  }
108  document.getElementById("width").focus();
109        window.resizeTo(420, 500);
110};
111
112function onOK() {
113  // pass data back to the calling window
114  var param = { width: document.getElementById("width").value,
115                height: document.getElementById("height").value,
116                sizeIncludesBars: (document.getElementById("sizeIncludesBars").checked?true:""),
117                statusBar: (document.getElementById("statusBar").checked?true:""),
118                mozParaHandler: document.getElementById("mozParaHandler").value,
119                undoSteps: document.getElementById("undoSteps").value,
120                baseHref: document.getElementById("baseHref").value,
121                stripBaseHref: (document.getElementById("stripBaseHref").checked?true:""),
122                stripSelfNamedAnchors: (document.getElementById("stripSelfNamedAnchors").checked?true:""),
123                only7BitPrintablesInURLs: (document.getElementById("only7BitPrintablesInURLs").checked?true:""),
124                sevenBitClean: (document.getElementById("sevenBitClean").checked?true:""),
125                killWordOnPaste: (document.getElementById("killWordOnPaste").checked?true:""),
126                flowToolbars: (document.getElementById("flowToolbars").checked?true:""),
127                            CharacterMapMode: document.getElementById("CharacterMapMode").value,
128                ListTypeOptions: document.getElementById("ListTypeMode").value
129                          };
130        __dlg_close(param);
131  return false;
132};
133
134function onCancel() {
135  __dlg_close(null);
136  return false;
137};
138
139</script>
140
141<style type="text/css">
142        .fr { width: 16em; float: left; padding: 2px 5px; text-align: right; }
143</style>
144
145</head>
146
147<body class="dialog" onload="Init()">
148<div class="title">Settings</div>
149  <form action="" method="get">
150    <div class="fr">Editor width:</div>
151      <input type="text" name="width" id="width" title="" />
152    <p />
153    <div class="fr">Editor height:</div>
154      <input type="text" name="height" id="height" title="" />
155    <p />
156    <div class="fr">Size includes bars</div>
157      <input type="checkbox" name="sizeIncludesBars" id="sizeIncludesBars" />
158    <p />
159    <div class="fr">Status Bar</div>
160      <input type="checkbox" name="statusBar" id="statusBar" />
161    <p />
162    <div class="fr">Mozilla Parameter Handler:</div>
163    <select name="mozParaHandler" id="mozParaHandler">
164      <option value="built-in">built-in</option>
165      <option value="dirty">dirty</option>
166      <option value="best">best</option>
167    </select>
168    <div class="space"></div>
169    <div class="fr">Undo steps:</div>
170      <input type="text" name="undoSteps" id="undoSteps" title="" />
171    <p />
172    <div class="fr">Base href:</div>
173      <input type="text" name="baseHref" id="baseHref" title="" />
174    <p />
175    <div class="fr">Strip base href</div>
176      <input type="checkbox" name="stripBaseHref" id="stripBaseHref" />
177    <p />
178    <div class="fr">Strip self named anchors</div>
179      <input type="checkbox" name="stripSelfNamedAnchors" id="stripSelfNamedAnchors" />
180    <p />
181    <div class="fr">only 7bit printables in URLs</div>
182      <input type="checkbox" name="only7BitPrintablesInURLs" id="only7BitPrintablesInURLs" />
183    <p />
184    <div class="fr">7bit Clean</div>
185      <input type="checkbox" name="sevenBitClean" id="sevenBitClean" />
186    <p />
187    <div class="fr">kill Word on paste</div>
188      <input type="checkbox" name="killWordOnPaste" id="killWordOnPaste" />
189    <p />
190    <div class="fr">flow toolbars</div>
191      <input type="checkbox" name="flowToolbars" id="flowToolbars" />
192    <p />
193
194    <div id="CharacterMapOptions" class="options">
195    <hr size="0.5">
196                <div class="fr">CharacterMap mode :</div>
197                  <select id="CharacterMapMode" name="CharacterMapMode">
198        <option value="popup">popup</option>
199        <option value="panel">panel</option>
200      </select>
201          </div>
202    <p />
203
204    <div id="ListTypeOptions" class="options">
205                <hr size="0.5">
206    <div class="fr">ListType mode :</div>
207                  <select id="ListTypeMode" name="ListTypeMode">
208        <option value="toolbar">toolbar</option>
209        <option value="panel">panel</option>
210      </select>
211    </div>
212                <p />
213     
214  <div id="buttons">
215    <button type="submit" name="ok" onclick="return onOK();">OK</button>
216    <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
217  </div>
218</form>
219</body>
220</html>
Note: See TracBrowser for help on using the repository browser.