blob: 0e0441b4c0f90b7bf2ef9ddeddef1481134d9ffb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
-->
<html>
<head>
<link rel="stylesheet" type="text/css" href="/ui.css">
<script type="text/javascript" src="/util.js"></script>
<script type="text/javascript" src="/elemutil.js"></script>
<script type="text/javascript" src="/xmlutil.js"></script>
<script type="text/javascript" src="/atomutil.js"></script>
<script type="text/javascript" src="/scdl.js"></script>
<script type="text/javascript" src="/ui.js"></script>
<script type="text/javascript" src="/component.js"></script>
<script type="text/javascript" src="page.js"></script>
</head>
<body>
<table style="position: absolute; top: 0px; left: 0px;" width="100%">
<tr><th style="width: 338px;">Palette</th><th>Page</th></tr>
</table>
<div id="page" style="position: absolute; top: 60px; left: 0px; width: 5000px; height: 5000px;">
<span id="palette:h1" style="position: absolute; left: 0px; top: 0px;"><h1>Header1</h1></span>
<span id="palette:h2" style="position: absolute; left: 0px; top: 40px;"><h2>Header2</h2></span>
<span id="palette:button" style="position: absolute; left: 0px; top: 80px;"><input type="button" value="button"/></span>
<span id="palette:entry" style="position: absolute; left: 0px; top: 120px;"><input type="text" value="field" size="5"/></span>
<span id="palette:password" style="position: absolute; left: 0px; top: 160px;"><input type="password" value="password" size="5"/></span>
<span id="palette:checkbox" style="position: absolute; left: 0px; top: 200px;"><input type="checkbox" value="checkbox"/>checkbox</span>
<span id="palette:select" style="position: absolute; left: 0px; top: 240px;"><select><option value="list">list</option></select></span>
<span id="palette:link" style="position: absolute; left: 0px; top: 280px;"><a href="">link</a></span>
<span id="palette:text" style="position: absolute; left: 0px; top: 320px;"><span>text</span></span>
<span id="palette:img" style="position: absolute; left: 0px; top: 360px;"><img/></span>
</div>
<div id="buffer" style="visibility: hidden; width: 0px; height: 0px">
</div>
<script type="text/javascript">
var editWidget = sca.component("EditWidget");
var pages = sca.reference(editWidget, "pages");
/**
* Return the current app name.
*/
function appname() {
return ui.queryParams()['app'];
}
/**
* Return the page in an ATOM entry.
*/
function atompage(doc) {
var entry = atom.readATOMEntryDocument(doc);
var item = caddr(entry);
return cddr(item);
}
/**
* Get and display an app page.
*/
function getpage(name, e) {
if (isNil(name))
return;
pages.get(name, function(doc) {
// Convert the page to XML
var x = writeStrings(writeXML(atompage(doc), false));
// Prepare page DOM in hidden buffer
var buffer = $('buffer');
buffer.innerHTML = x;
// Append page nodes to editor
map(function(e) {
e.style.left = ui.posn(e.style.left) + 350;
pageedit.appendChild(e);
return page.cover(e);
}, nodeList(buffer.childNodes[0].childNodes));
});
}
// Initialize the page editor
var pageedit = $('page');
page.initpage(pageedit);
// Get and display the current app page
getpage(appname(), pageedit);
</script>
</body>
</html>
|