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
258ef1c7
Commit
258ef1c7
authored
Sep 01, 2011
by
François Billioud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment and correct DAVStorage
parent
caa4fec2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
193 deletions
+139
-193
UNGProject/unhosted/jio.js
UNGProject/unhosted/jio.js
+139
-193
No files found.
UNGProject/unhosted/jio.js
View file @
258ef1c7
...
...
@@ -70,11 +70,12 @@
/*************************************************************************
************************* specific storages *****************************/
/************************************************************
*********************** DAVstorage *************************/
/************************************************************
*********************** DAVstorage *************************/
/**
* Class DAVStorage
* @class provides usual API to save/load/delete documents on a storage webDav
...
...
@@ -237,61 +238,6 @@
},
/**
* load the list of the documents in this storage
* @param option : optional object containing
* "success" : the function to execute when the load is done
* "errorHandler" : the function to execute if an error occures
* "asynchronous" : a boolean set to false if the request must be synchronous
* @return null if the request is asynchronous, the list of documents otherwise.
* @example {"file1":{fileName:"file1",creationDate:"Tue, 23 Aug 2011 15:18:32 GMT",lastModified:"Tue, 23 Aug 2011 15:18:32 GMT"},...}
*/
getDocumentList
:
function
(
option
)
{
var
storage
=
this
;
var
list
=
null
;
$
.
ajax
({
url
:
storage
.
location
+
"
/dav/
"
+
storage
.
userName
+
"
/
"
+
storage
.
applicationID
+
"
/
"
,
async
:
option
.
asyncronous
||
true
,
type
:
"
PROPFIND
"
,
dataType
:
"
xml
"
,
headers
:
{
Authorization
:
"
Basic
"
+
Base64
.
encode
(
this
.
userName
+
"
:
"
+
this
.
applicationPassword
),
Depth
:
"
1
"
},
fields
:
{
withCredentials
:
"
true
"
},
success
:
function
(
data
)
{
list
=
xml2jsonFileList
(
data
);
if
(
option
.
success
)
option
.
success
(
list
)},
error
:
option
.
errorHandler
||
function
(
type
)
{
alert
(
"
Error
"
+
type
.
status
+
"
: fail while trying to load file list
"
);}
});
return
list
;
//warning : always null if asyncronous
function
xml2jsonFileList
(
xmlData
)
{
//transform the xml into a list
var
fileList
=
{};
$
(
"
D
\\
:response
"
,
xmlData
)
.
each
(
function
(
i
,
data
){
if
(
i
>
0
)
{
//exclude the parent folder
var
name
=
fileName
(
data
);
fileList
[
name
]
=
xml2jsonFile
(
data
)
fileList
[
name
].
fileName
=
name
;
}
});
//remove webDav files from the list
delete
fileList
[
"
.htaccess
"
];
delete
fileList
[
"
.htpasswd
"
];
return
fileList
;
}
function
xml2jsonFile
(
xmlData
)
{
//transform the xml about a file into json information
var
file
=
{};
file
.
lastModified
=
$
(
$
(
"
lp1
\\
:getlastmodified
"
,
xmlData
).
get
(
0
)).
text
();
file
.
creationDate
=
$
(
$
(
"
lp1
\\
:creationdate
"
,
xmlData
).
get
(
0
)).
text
();
return
file
;
}
function
fileName
(
xmlData
)
{
//read the name of a file in the xml
var
string
=
$
(
$
(
"
D
\\
:href
"
,
xmlData
).
get
(
0
)).
text
()
var
T
=
string
.
split
(
"
/
"
);
return
T
[
T
.
length
-
1
]
?
T
[
T
.
length
-
1
]
:
T
[
T
.
length
-
2
]
+
"
/
"
;
}
}
}
/************************************************************
*********************** LocalStorage ************************/
/**
...
...
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