Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
e50d7ab5
Commit
e50d7ab5
authored
Jun 21, 2011
by
François Billioud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prepare the jio implementation
move xhr functions to jio.js
parent
769179ee
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
144 deletions
+92
-144
UNGProject/js/editor.js
UNGProject/js/editor.js
+0
-70
UNGProject/js/illustration.js
UNGProject/js/illustration.js
+0
-67
UNGProject/js/jio.js
UNGProject/js/jio.js
+67
-0
UNGProject/js/theme.js
UNGProject/js/theme.js
+6
-1
UNGProject/js/tools.js
UNGProject/js/tools.js
+1
-1
UNGProject/theme.html
UNGProject/theme.html
+18
-5
No files found.
UNGProject/js/editor.js
View file @
e50d7ab5
...
@@ -51,73 +51,3 @@ getCurrentDocument = function() {
...
@@ -51,73 +51,3 @@ getCurrentDocument = function() {
doc
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
doc
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
return
doc
;
return
doc
;
}
}
// save
saveXHR
=
function
()
{
//create request
var
xhr
=
null
;
try
{
xhr
=
new
XMLHttpRequest
();
}
catch
(
e
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);}
catch
(
e2
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);}
catch
(
e
)
{
alert
(
"
Please install a more recent browser
"
)}
}
}
//xhr.open("PUT", keyToUrl(key, wallet), true, wallet.userAddress, wallet.davToken);
//HACK:
xhr
.
open
(
"
PUT
"
,
"
dav/temp.json
"
,
true
);
xhr
.
setRequestHeader
(
"
Authorization
"
,
"
Basic
"
+
"
nom:test
"
);
//END HACK.
xhr
.
onreadystatechange
=
function
()
{
if
(
xhr
.
readyState
==
4
)
{
if
(
xhr
.
status
!=
200
&&
xhr
.
status
!=
201
&&
xhr
.
status
!=
204
)
{
alert
(
"
error: got status
"
+
xhr
.
status
+
"
when doing basic auth PUT on url
"
+
Base64
.
encode
(
"
nom:test
"
)
+
"
"
+
xhr
.
statusText
);
}
}
}
xhr
.
withCredentials
=
"
true
"
;
xhr
.
send
(
JSON
.
stringify
(
getCurrentDocument
()));
}
// load
loadXHR
=
function
()
{
//create request
var
xhr
=
null
;
try
{
xhr
=
new
XMLHttpRequest
();
}
catch
(
e
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);}
catch
(
e2
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);}
catch
(
e
)
{}
}
}
xhr
.
open
(
"
GET
"
,
"
dav/temp.json
"
,
false
);
xhr
.
onreadystatechange
=
function
()
{
if
(
xhr
.
readyState
==
4
)
{
var
cDoc
=
new
JSONTextDocument
();
if
(
xhr
.
status
==
200
)
{
cDoc
.
load
(
JSON
.
parse
(
xhr
.
responseText
));
}
else
{
alert
(
"
error: got status
"
+
xhr
.
status
+
"
when doing basic auth GET on url
"
+
"
nom:test
"
+
"
"
+
xhr
.
statusText
);
}
cDoc
.
setAsCurrentDocument
();
}
}
xhr
.
send
();
}
UNGProject/js/illustration.js
View file @
e50d7ab5
...
@@ -51,70 +51,3 @@ getCurrentDocument = function() {
...
@@ -51,70 +51,3 @@ getCurrentDocument = function() {
return
doc
;
return
doc
;
}
}
// save
saveXHR
=
function
()
{
//create request
var
xhr
=
null
;
try
{
xhr
=
new
XMLHttpRequest
();
}
catch
(
e
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);}
catch
(
e2
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);}
catch
(
e
)
{
alert
(
"
Please install a more recent browser
"
)}
}
}
//xhr.open("PUT", keyToUrl(key, wallet), true, wallet.userAddress, wallet.davToken);
//HACK:
xhr
.
open
(
"
PUT
"
,
"
dav/temp2.json
"
,
true
);
xhr
.
setRequestHeader
(
"
Authorization
"
,
"
Basic
"
+
"
nom:test
"
);
//END HACK.
xhr
.
onreadystatechange
=
function
()
{
if
(
xhr
.
readyState
==
4
)
{
if
(
xhr
.
status
!=
200
&&
xhr
.
status
!=
201
&&
xhr
.
status
!=
204
)
{
alert
(
"
error: got status
"
+
xhr
.
status
+
"
when doing basic auth PUT on url
"
+
Base64
.
encode
(
"
nom:test
"
)
+
"
"
+
xhr
.
statusText
);
}
}
}
xhr
.
withCredentials
=
"
true
"
;
xhr
.
send
(
JSON
.
stringify
(
getCurrentDocument
()));
}
// load
loadXHR
=
function
()
{
//create request
var
xhr
=
null
;
try
{
xhr
=
new
XMLHttpRequest
();
}
catch
(
e
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);}
catch
(
e2
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);}
catch
(
e
)
{}
}
}
xhr
.
open
(
"
GET
"
,
"
dav/temp2.json
"
,
false
);
xhr
.
onreadystatechange
=
function
()
{
if
(
xhr
.
readyState
==
4
)
{
var
cDoc
=
new
JSONIllustrationDocument
();
if
(
xhr
.
status
==
200
)
{
cDoc
.
load
(
JSON
.
parse
(
xhr
.
responseText
));
}
else
{
alert
(
"
error: got status
"
+
xhr
.
status
+
"
when doing basic auth GET on url
"
+
"
nom:test
"
+
"
"
+
xhr
.
statusText
);
}
cDoc
.
setAsCurrentDocument
();
}
}
xhr
.
send
();
}
\ No newline at end of file
UNGProject/js/jio.js
0 → 100644
View file @
e50d7ab5
// save
saveXHR
=
function
(
address
)
{
//create request
var
xhr
=
null
;
try
{
xhr
=
new
XMLHttpRequest
();
}
catch
(
e
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);}
catch
(
e2
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);}
catch
(
e
)
{
alert
(
"
Please install a more recent browser
"
)}
}
}
//xhr.open("PUT", keyToUrl(key, wallet), true, wallet.userAddress, wallet.davToken);
//HACK:
xhr
.
open
(
"
PUT
"
,
address
,
true
);
xhr
.
setRequestHeader
(
"
Authorization
"
,
"
Basic
"
+
"
nom:test
"
);
//END HACK.
xhr
.
onreadystatechange
=
function
()
{
if
(
xhr
.
readyState
==
4
)
{
if
(
xhr
.
status
!=
200
&&
xhr
.
status
!=
201
&&
xhr
.
status
!=
204
)
{
alert
(
"
error: got status
"
+
xhr
.
status
+
"
when doing basic auth PUT on url
"
+
Base64
.
encode
(
"
nom:test
"
)
+
"
"
+
xhr
.
statusText
);
}
}
}
xhr
.
withCredentials
=
"
true
"
;
xhr
.
send
(
JSON
.
stringify
(
getCurrentDocument
()));
}
// load
loadXHR
=
function
(
address
)
{
//create request
var
xhr
=
null
;
try
{
xhr
=
new
XMLHttpRequest
();
}
catch
(
e
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);}
catch
(
e2
)
{
try
{
xhr
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);}
catch
(
e
)
{}
}
}
xhr
.
open
(
"
GET
"
,
address
,
false
);
xhr
.
onreadystatechange
=
function
()
{
if
(
xhr
.
readyState
==
4
)
{
var
cDoc
=
getCurrentDocument
();
if
(
xhr
.
status
==
200
)
{
cDoc
.
load
(
JSON
.
parse
(
xhr
.
responseText
));
}
else
{
alert
(
"
error: got status
"
+
xhr
.
status
+
"
when doing basic auth GET on url
"
+
"
nom:test
"
+
"
"
+
xhr
.
statusText
);
}
cDoc
.
setAsCurrentDocument
();
}
}
xhr
.
send
();
}
\ No newline at end of file
UNGProject/js/theme.js
View file @
e50d7ab5
...
@@ -55,17 +55,22 @@ Page.prototype = {
...
@@ -55,17 +55,22 @@ Page.prototype = {
$
(
dependencies
).
find
(
"
linkfile
"
).
each
(
function
()
{
currentPage
.
include
(
$
(
this
).
text
(),
"
link
"
);});
//includes css
$
(
dependencies
).
find
(
"
linkfile
"
).
each
(
function
()
{
currentPage
.
include
(
$
(
this
).
text
(),
"
link
"
);});
//includes css
$
(
dependencies
).
find
(
"
scriptfile
"
).
each
(
function
()
{
currentPage
.
include
(
$
(
this
).
text
(),
"
script
"
);});
//includes js
$
(
dependencies
).
find
(
"
scriptfile
"
).
each
(
function
()
{
currentPage
.
include
(
$
(
this
).
text
(),
"
script
"
);});
//includes js
var
doc
=
null
;
switch
(
this
.
name
)
{
switch
(
this
.
name
)
{
case
"
editor
"
:
case
"
editor
"
:
this
.
editor
=
new
Xinha
();
this
.
editor
=
new
Xinha
();
if
(
!
doc
)
{
doc
=
new
JSONTextDocument
();}
break
;
break
;
case
"
table
"
:
case
"
table
"
:
this
.
editor
=
new
SheetEditor
();
this
.
editor
=
new
SheetEditor
();
if
(
!
doc
)
{
doc
=
new
JSONSheetDocument
();}
break
;
break
;
case
"
illustration
"
:
case
"
illustration
"
:
this
.
editor
=
new
SVGEditor
();
this
.
editor
=
new
SVGEditor
();
if
(
!
doc
)
{
doc
=
new
JSONIllustrationDocument
();}
break
;
break
;
}
}
doc
.
setCurrentDocument
();
},
},
/* include a javascript or a css file */
/* include a javascript or a css file */
...
@@ -270,7 +275,7 @@ editDocumentSettings = function() {
...
@@ -270,7 +275,7 @@ editDocumentSettings = function() {
saveCurrentDocument
=
function
()
{
saveCurrentDocument
=
function
()
{
getCurrentPage
().
getEditor
().
saveEdition
();
getCurrentPage
().
getEditor
().
saveEdition
();
saveXHR
();
saveXHR
(
address
);
//saveJIO(); : JIO function
//saveJIO(); : JIO function
}
}
...
...
UNGProject/js/tools.js
View file @
e50d7ab5
UNGProject/theme.html
View file @
e50d7ab5
...
@@ -26,21 +26,31 @@
...
@@ -26,21 +26,31 @@
<script
type=
"text/javascript"
src=
"js/base64.js"
></script>
<script
type=
"text/javascript"
src=
"js/base64.js"
></script>
<script
type=
"text/javascript"
src=
"js/tools.js"
></script>
<script
type=
"text/javascript"
src=
"js/tools.js"
></script>
<script
type=
"text/javascript"
src=
"js/jio.js"
></script>
<script
type=
"text/javascript"
src=
"js/theme.js"
></script>
<script
type=
"text/javascript"
src=
"js/theme.js"
></script>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
// initialize
// initialize
init
=
function
()
{
var
initPage
=
function
()
{
setCurrentPage
(
"
editor
"
);
var
pageIWantToTest
=
"
illustration
"
;
setCurrentPage
(
pageIWantToTest
);
}
var
initUser
=
function
()
{
var
user
=
getCurrentUser
();
var
user
=
getCurrentUser
();
if
(
!
user
)
{
user
=
new
User
();}
if
(
!
user
)
{
user
=
new
User
();}
user
.
setAsCurrentUser
();
user
.
setAsCurrentUser
();
}
var
doc
=
getCurrentDocument
();
var
initDocument
=
function
()
{
if
(
!
doc
)
{
doc
=
new
JSONTextDocument
();}
loadXHR
(
"
dav/temp2.json
"
);
doc
.
setAsCurrentDocument
();
}
var
init
=
function
()
{
initPage
();
waitBeforeExecution
(
getCurrentPage
(),
initUser
);
waitBeforeExecution
(
getCurrentPage
().
getEditor
(),
initDocument
);
}
}
$
(
document
).
ready
(
init
);
$
(
document
).
ready
(
init
);
</script>
</script>
...
@@ -262,6 +272,9 @@
...
@@ -262,6 +272,9 @@
<div
id=
"page_content"
class=
"field page"
<div
id=
"page_content"
class=
"field page"
title=
"Contenu de la page web."
>
title=
"Contenu de la page web."
>
</div>
</div>
<div
id=
"document_content"
class=
"field hidden"
title=
"The content of the document considered as a text string"
>
</div>
</fieldset>
</fieldset>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment