Revision 49b77086
| b/javascriptzip/fancy.html | ||
|---|---|---|
| 1 |
<html> |
|
| 2 |
<head> |
|
| 3 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|
| 4 |
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"> |
|
| 5 |
|
|
| 6 |
<!-- Include here your own css files if you have them. --> |
|
| 7 |
<style type="text/css" media="screen"> |
|
| 8 |
html body {
|
|
| 9 |
width: 100%; height: 100%; |
|
| 10 |
border: 0 none; margin: 0; padding: 0; |
|
| 11 |
overflow: hidden; |
|
| 12 |
position: relative; |
|
| 13 |
} |
|
| 14 |
</style> |
|
| 15 |
|
|
| 16 |
<!-- First of javascript includes must be an adapter... --> |
|
| 17 |
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script> |
|
| 18 |
|
|
| 19 |
<!-- ...then you need the Ext itself, either debug or production version. --> |
|
| 20 |
<script type="text/javascript" src="ext/ext-all-debug.js"></script> |
|
| 21 |
|
|
| 22 |
<!-- Include here your extended classes if you have some. --> |
|
| 23 |
|
|
| 24 |
<!-- Include here you application javascript file if you have it. --> |
|
| 25 |
<script type="text/javascript" src="odf.js"></script> |
|
| 26 |
|
|
| 27 |
<title id="page-title">WebODF?</title> |
|
| 28 |
</head> |
|
| 29 |
|
|
| 30 |
<!-- You can leave the body empty in many cases, or you write your content in it. --> |
|
| 31 |
<body id='body' scroll='no'> |
|
| 32 |
</body> |
|
| 33 |
</html> |
|
| b/javascriptzip/filelist.js | ||
|---|---|---|
| 1 | 1 |
var fileList = [ |
| 2 |
'../odfkit/LayoutTests/fast/odf/script-tests/hello-odf-2.odt', |
|
| 3 |
'../odfkit/LayoutTests/fast/odf/script-tests/hello-odf-1.odt', |
|
| 4 |
'../odfkit/LayoutTests/platform/mac/fast/loader/resources/mimeTypeExamples/example-ods.ods', |
|
| 5 |
'../lpod-python/test/samples/note.odt', |
|
| 6 |
'../lpod-python/test/samples/list.odt', |
|
| 7 |
'../lpod-python/test/samples/frame_image.odp', |
|
| 8 |
'../lpod-python/test/samples/bookmark.odt', |
|
| 9 |
'../lpod-python/test/samples/span_a.odt', |
|
| 10 |
'../lpod-python/test/samples/toc.odt', |
|
| 11 |
'../lpod-python/test/samples/meta.odt', |
|
| 12 |
'../lpod-python/test/samples/base_text.odt', |
|
| 13 |
'../lpod-python/test/samples/span_style.odt', |
|
| 14 |
'../lpod-python/test/samples/variable.odt', |
|
| 15 |
'../lpod-python/test/samples/example.odp', |
|
| 16 |
'../lpod-python/test/samples/base_shapes.odg', |
|
| 17 |
'../lpod-python/test/samples/simple_table.ods', |
|
| 18 |
'../lpod-python/test/samples/example.odt', |
|
| 19 |
'../lpod-python/test/samples/styled_table.ods', |
|
| 20 |
'../lpod-python/test/samples/tracked_changes.odt', |
|
| 21 |
'../lpod-python/templates/lpod_styles.odt', |
|
| 2 |
'../../../odfkit/odfkit/odfkit/LayoutTests/fast/odf/script-tests/hello-odf-2.odt', |
|
| 3 |
'../../../odfkit/odfkit/odfkit/LayoutTests/fast/odf/script-tests/hello-odf-1.odt', |
|
| 4 |
'../../../odfkit/odfkit/odfkit/LayoutTests/platform/mac/fast/loader/resources/mimeTypeExamples/example-ods.ods', |
|
| 5 |
'../../../odfkit/odfkit/lpod-python/test/samples/note.odt', |
|
| 6 |
'../../../odfkit/odfkit/lpod-python/test/samples/list.odt', |
|
| 7 |
'../../../odfkit/odfkit/lpod-python/test/samples/frame_image.odp', |
|
| 8 |
'../../../odfkit/odfkit/lpod-python/test/samples/bookmark.odt', |
|
| 9 |
'../../../odfkit/odfkit/lpod-python/test/samples/span_a.odt', |
|
| 10 |
'../../../odfkit/odfkit/lpod-python/test/samples/toc.odt', |
|
| 11 |
'../../../odfkit/odfkit/lpod-python/test/samples/meta.odt', |
|
| 12 |
'../../../odfkit/odfkit/lpod-python/test/samples/base_text.odt', |
|
| 13 |
'../../../odfkit/odfkit/lpod-python/test/samples/span_style.odt', |
|
| 14 |
'../../../odfkit/odfkit/lpod-python/test/samples/variable.odt', |
|
| 15 |
'../../../odfkit/odfkit/lpod-python/test/samples/example.odp', |
|
| 16 |
'../../../odfkit/odfkit/lpod-python/test/samples/base_shapes.odg', |
|
| 17 |
'../../../odfkit/odfkit/lpod-python/test/samples/simple_table.ods', |
|
| 18 |
'../../../odfkit/odfkit/lpod-python/test/samples/example.odt', |
|
| 19 |
'../../../odfkit/odfkit/lpod-python/test/samples/styled_table.ods', |
|
| 20 |
'../../../odfkit/odfkit/lpod-python/test/samples/tracked_changes.odt', |
|
| 21 |
'../../../odfkit/odfkit/lpod-python/templates/lpod_styles.odt', |
|
| 22 |
'../../../ictu/ictu/xsl-odt/z2.odt', |
|
| 23 |
'../../../ictu/ictu/xsl-odt/gerechtelijkeaankondigingen/input/stcrt-2010-8050.odt', |
|
| 24 |
'../../../ictu/ictu/odfquality/stcrt-2010-6505/stcrt-2010-6505.odt', |
|
| 25 |
'../../../ictu/ictu/odfquality/kst-31460-12/kst-31460-12.odt', |
|
| 26 |
'../../../ictu/ictu/odfquality/ah-tk-20092010-2140/ah-tk-20092010-2140.odt', |
|
| 27 |
'../../../ictu/ictu/odfquality/kv-tk-2010Z06142/kv-tk-2010Z06142.odt', |
|
| 28 |
'../../../ictu/ictu/odfquality/stb-2010-161/stb-2010-161.odt', |
|
| 22 | 29 |
]; |
| b/javascriptzip/lighttpd.conf | ||
|---|---|---|
| 10 | 10 |
".jpg" => "image/jpeg", |
| 11 | 11 |
".png" => "image/png" |
| 12 | 12 |
) |
| 13 |
server.modules = ( |
|
| 14 |
"mod_webdav" |
|
| 15 |
) |
|
| 13 |
server.modules += ( "mod_webdav", "mod_cgi" ) |
|
| 16 | 14 |
|
| 17 |
$HTTP["url"] =~ "^/javascriptzip($|/)" {
|
|
| 15 |
$HTTP["url"] =~ "^/odfkit/odfkit/javascriptzip($|/)" {
|
|
| 18 | 16 |
webdav.activate = "enable" |
| 19 | 17 |
webdav.is-readonly = "disable" |
| 20 |
} |
|
| 18 |
auth.backend = "htpasswd" |
|
| 19 |
auth.backend.htpasswd.userfile = "/var/www/web1/passwd.dav" |
|
| 20 |
auth.require = ( "" => ( "method" => "basic", |
|
| 21 |
"realm" => "webdav", |
|
| 22 |
"require" => "valid-user" ) ) |
|
| 21 | 23 |
|
| 24 |
cgi.assign = ( "pl" => "/usr/bin/perl" ) |
|
| 25 |
} |
|
| b/javascriptzip/odf.html | ||
|---|---|---|
| 1 |
<html> |
|
| 2 |
<head> |
|
| 3 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|
| 4 |
<style type="text/css" media="screen"> |
|
| 5 |
html body {
|
|
| 6 |
width: 100%; height: 100%; |
|
| 7 |
border: 0 none; margin: 0; padding: 0; |
|
| 8 |
overflow: hidden; |
|
| 9 |
position: relative; |
|
| 10 |
} |
|
| 11 |
</style> |
|
| 12 |
<!-- <script type="text/javascript" src="odf.js"></script> --> |
|
| 13 |
<script type="text/javascript" charset="utf-8"> |
|
| 14 |
function init() {
|
|
| 15 |
var location = new String(document.location); |
|
| 16 |
var pos = location.indexOf('#');
|
|
| 17 |
if (pos != -1) {
|
|
| 18 |
location = location.substr(pos+1); |
|
| 19 |
} |
|
| 20 |
document.body.innerHTML = location; |
|
| 21 |
} |
|
| 22 |
</script> |
|
| 23 |
|
|
| 24 |
<title>WebODF?</title> |
|
| 25 |
</head> |
|
| 26 |
|
|
| 27 |
<body onload='init()'> |
|
| 28 |
</body> |
|
| 29 |
</html> |
|
| b/javascriptzip/odf.js | ||
|---|---|---|
| 1 |
Ext.BLANK_IMAGE_URL = './ext/resources/images/default/s.gif'; |
|
| 2 |
|
|
| 3 |
Ext.onReady(function(){
|
|
| 4 |
|
|
| 5 |
var tree = new Ext.tree.TreePanel({
|
|
| 6 |
region:'west', |
|
| 7 |
width:200, |
|
| 8 |
split:true, |
|
| 9 |
collapsible:true, |
|
| 10 |
rootVisible: false, |
|
| 11 |
root: { nodeType: 'node' },
|
|
| 12 |
}); |
|
| 13 |
var panel = new Ext.Panel({
|
|
| 14 |
layout:'border', |
|
| 15 |
height:1000, |
|
| 16 |
//autoHeight:true, |
|
| 17 |
renderTo:Ext.getBody(), |
|
| 18 |
items:[ |
|
| 19 |
{region:'center',layout:'fit',frame:true,border:false},
|
|
| 20 |
tree |
|
| 21 |
] |
|
| 22 |
}); |
|
| 23 |
|
|
| 24 |
// put data in the tree |
|
| 25 |
fillTree(tree.getRootNode(), './a/b/'); |
|
| 26 |
}); |
|
| 27 |
|
|
| 28 |
function getFileList(url, suffix) {
|
|
| 29 |
var req = new XMLHttpRequest(); |
|
| 30 |
req.open('PROPFIND', url, false);
|
|
| 31 |
req.setRequestHeader('Depth', '1');
|
|
| 32 |
req.send(); |
|
| 33 |
if (req.status < 200 || req.status >= 300) {
|
|
| 34 |
throw new Error(req.status + ' ' + req.statusText + ' ' + req.responseText); |
|
| 35 |
} |
|
| 36 |
var xml = req.responseXML; |
|
| 37 |
if (!xml) {
|
|
| 38 |
throw new Error('No proper XML response.');
|
|
| 39 |
} |
|
| 40 |
var refs = xml.getElementsByTagNameNS('DAV:', 'href');
|
|
| 41 |
var list = []; |
|
| 42 |
var len = suffix.length; |
|
| 43 |
for (var i in refs) {
|
|
| 44 |
if (refs[i].firstChild) {
|
|
| 45 |
var name = refs[i].firstChild.nodeValue; |
|
| 46 |
if (name.substr(name.length-len) == suffix) {
|
|
| 47 |
list[list.length] = name; |
|
| 48 |
} |
|
| 49 |
} |
|
| 50 |
} |
|
| 51 |
return list; |
|
| 52 |
} |
|
| 53 |
|
|
| 54 |
function getRoot(list) {
|
|
| 55 |
var root = ''; |
|
| 56 |
var minlength = 9999; |
|
| 57 |
for (var i in list) {
|
|
| 58 |
if (typeof list[i] != 'string') continue; |
|
| 59 |
if (list[i].length < minlength) {
|
|
| 60 |
root = list[i]; |
|
| 61 |
minlength = root.length; |
|
| 62 |
} |
|
| 63 |
} |
|
| 64 |
for (var i in list) {
|
|
| 65 |
if (typeof list[i] != 'string') continue; |
|
| 66 |
if (list[i].substr(0, root.length) != root) {
|
|
| 67 |
return ''; |
|
| 68 |
} |
|
| 69 |
} |
|
| 70 |
return root; |
|
| 71 |
} |
|
| 72 |
|
|
| 73 |
function getDirList(url) {
|
|
| 74 |
return getFileList(url, '/'); |
|
| 75 |
} |
|
| 76 |
|
|
| 77 |
function getOdtList(url) {
|
|
| 78 |
return getFileList(url, '.odt'); |
|
| 79 |
} |
|
| 80 |
|
|
| 81 |
function getTree(url) {
|
|
| 82 |
var tree = []; |
|
| 83 |
var list = getDirList(url); |
|
| 84 |
var root = getRoot(list); |
|
| 85 |
var foundfile = false; |
|
| 86 |
for (var i in list) {
|
|
| 87 |
if (typeof list[i] != 'string' || list[i] == root) continue; |
|
| 88 |
var children = getTree(list[i]); |
|
| 89 |
if (!children) continue; |
|
| 90 |
foundfile = true; |
|
| 91 |
var entry = new Object(); |
|
| 92 |
var text = list[i].substr(root.length); |
|
| 93 |
entry.id = list[i]; |
|
| 94 |
entry.text = text.substr(0, text.length-1); |
|
| 95 |
entry.cls = 'folder'; |
|
| 96 |
entry.editable = false; |
|
| 97 |
entry.children = children; |
|
| 98 |
tree[tree.length] = entry; |
|
| 99 |
} |
|
| 100 |
list = getOdtList(url); |
|
| 101 |
for (var i in list) {
|
|
| 102 |
if (typeof list[i] != 'string') continue; |
|
| 103 |
var entry = new Object(); |
|
| 104 |
entry.id = list[i]; |
|
| 105 |
entry.text = list[i].substr(root.length); |
|
| 106 |
entry.cls = 'file'; |
|
| 107 |
entry.leaf = true; |
|
| 108 |
entry.editable = false; |
|
| 109 |
entry.listeners = { click: function(node) { loadODF(node.id); } };
|
|
| 110 |
entry.href = 'odf.html#'+list[i] |
|
| 111 |
tree[tree.length] = entry; |
|
| 112 |
foundfile = true; |
|
| 113 |
} |
|
| 114 |
if (foundfile) return tree; |
|
| 115 |
return null; |
|
| 116 |
} |
|
| 117 |
|
|
| 118 |
function fillTree(root, dir) {
|
|
| 119 |
var filetree = getTree('./a/');
|
|
| 120 |
if (filetree) {
|
|
| 121 |
root.appendChild(filetree); |
|
| 122 |
} |
|
| 123 |
} |
|
| 124 |
|
|
| 125 |
function loadODF(url) {
|
|
| 126 |
// alert(url); |
|
| 127 |
} |
|
| b/javascriptzip/update.sh | ||
|---|---|---|
| 1 | 1 |
#! /bin/bash |
| 2 | 2 |
echo 'var fileList = [' > filelist.js |
| 3 |
for f in `find .. -size +0 -type f -name '*.od?'`; do echo "'$f',"; done >> filelist.js |
|
| 3 |
for f in `find ../../.. -size +0 -type f -name '*.od?'`; do echo "'$f',"; done >> filelist.js
|
|
| 4 | 4 |
echo '];' >> filelist.js |
| b/javascriptzip/zip.js | ||
|---|---|---|
| 98 | 98 |
|
| 99 | 99 |
function save_file(url, data) {
|
| 100 | 100 |
var req = new XMLHttpRequest(); |
| 101 |
req.open('PUT', url, false);
|
|
| 102 |
// req.setRequestHeader("Content-Transfer-Encoding", "base64");
|
|
| 103 |
// req.overrideMimeType('application/octet-stream');
|
|
| 104 |
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
| 101 |
req.open('POST', url, false);
|
|
| 105 | 102 |
var cleanstring = ""; |
| 106 | 103 |
for (var i in data) {
|
| 107 | 104 |
cleanstring += String.fromCharCode(data.charCodeAt(i) & 0xff); |
| ... | ... | |
| 110 | 107 |
if (req.sendAsBinary) {
|
| 111 | 108 |
req.sendAsBinary(cleanstring); |
| 112 | 109 |
} else {
|
| 113 |
req.send(cleanstring); |
|
| 110 |
// does not work, all input to send is always encoded as UTF-8 in WebKit |
|
| 111 |
// req.setRequestHeader('Content-transfer-encoding', 'quoted-printable');
|
|
| 112 |
// req.setRequestHeader('Transfer-encoding', 'quoted-printable');
|
|
| 113 |
// req.setRequestHeader('Transfer-Encoding', 'quoted-printable');
|
|
| 114 |
data = Base64.toBase64(data); |
|
| 115 |
alert(data); |
|
| 116 |
req.setRequestHeader('Content-Type', 'application/octet-stream');
|
|
| 117 |
req.setRequestHeader('Content-Transfer-Encoding', 'base64');
|
|
| 118 |
req.send(data);//encodeQuotedPrintable(data)); |
|
| 114 | 119 |
} |
| 115 |
|
|
| 116 |
// alert(cleanstring + ' ' + data); |
|
| 117 |
// alert(req.status + ' ' + url + ' ' + data.length); |
|
| 118 | 120 |
} |
| 119 | 121 |
|
| 120 | 122 |
function get_file_size(url) {
|
| b/odfkit | ||
|---|---|---|
| 1 |
Subproject commit dd1e40661266429df119a46e65aea0794bb772f0 |
|
| 1 |
Subproject commit e40a65a92013f74ef08ea13c3e30bc5ba40d1879 |
|
Also available in: Unified diff