Commit 27a2fbde authored by Jonathan Rivalan's avatar Jonathan Rivalan

corrected the alldocs S

parent aaa2641c
...@@ -295,12 +295,6 @@ ...@@ -295,12 +295,6 @@
jio, jio,
isAttachment, isAttachment,
callback) { callback) {
console.log(command)
console.log(obj)
console.log(http)
console.log(jio)
console.log(isAttachment)
console.log(callback)
obj.onreadystatechange = function () { obj.onreadystatechange = function () {
var response, err = ''; var response, err = '';
if (obj.readyState === 4) { if (obj.readyState === 4) {
...@@ -584,7 +578,6 @@ ...@@ -584,7 +578,6 @@
if (response === '404') { if (response === '404') {
postDocument(); postDocument();
} else { } else {
console.log('ERROR!');
//si ce n'est pas une 404, //si ce n'est pas une 404,
//alors on renvoit une erreur 405 //alors on renvoit une erreur 405
return command.error( return command.error(
...@@ -933,7 +926,6 @@ ...@@ -933,7 +926,6 @@
allDocResponse = { allDocResponse = {
// document content will be added to response // document content will be added to response
"total_rows": resultTable.length, "total_rows": resultTable.length,
"offset": 0,
"rows": [] "rows": []
}; };
...@@ -1016,11 +1008,32 @@ ...@@ -1016,11 +1008,32 @@
keyId = resultTable[i]; keyId = resultTable[i];
allDocResponse.rows[i] = { allDocResponse.rows[i] = {
"id": priv.fileNameToIds(keyId).join(), "id": priv.fileNameToIds(keyId).join(),
"key": keyId,
"value": {} "value": {}
}; };
} }
// allDocResponse = {
// "data": {
// "total_rows": 2,
// "rows": [{
// "id": "lol",
// "value": {}
// }, {
// "id": "b",
// "value": {}
// }]
// },
// "method": "allDocs",
// "result": "success",
// "status": 200,
// "statusText": "Ok"
// };
allDocResponse = {"data":allDocResponse};
command.success(allDocResponse); command.success(allDocResponse);
//} //}
} }
...@@ -1033,7 +1046,6 @@ ...@@ -1033,7 +1046,6 @@
} }
); );
} }
getXML(); getXML();
//fin alldocs //fin alldocs
}; };
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
if (typeof s3storage_spec === 'object') { if (typeof s3storage_spec === 'object') {
use_fake_server = false; use_fake_server = false;
spec = s3storage_spec; spec = s3storage_spec;
console.log(spec);
} else { } else {
spec = dav_storage.createDescription( spec = dav_storage.createDescription(
"http://localhost", "http://localhost",
...@@ -121,92 +120,10 @@ ...@@ -121,92 +120,10 @@
} }
function listDocuments() { function listDocuments() {
//quelle utilité à pousser le xml ?
responses.push([ responses.push([
207, 200,
{"Content-Type": "text/xml"}, {"Content-Type": "text/xml"},''
'<?xml version="1.0" encoding="utf-8"?>' +
'<D:multistatus xmlns:D="DAV:">' +
'<D:response xmlns:lp2="http://apache.' +
'org/dav/props/" xmlns:lp1="DAV:">' +
'<D:href>/uploads/</D:href>' +
'<D:propstat>' +
'<D:prop>' +
'<lp1:resourcetype><D:collection/></lp1:resourcetype>' +
'<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>' +
'<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT' +
'</lp1:getlastmodified>' +
'<lp1:getetag>"240be-1000-4e6bb383e5fbb"</lp1:getetag>' +
'<D:supportedlock>' +
'<D:lockentry>' +
'<D:lockscope><D:exclusive/></D:lockscope>' +
'<D:locktype><D:write/></D:locktype>' +
'</D:lockentry>' +
'<D:lockentry>' +
'<D:lockscope><D:shared/></D:lockscope>' +
'<D:locktype><D:write/></D:locktype>' +
'</D:lockentry>' +
'</D:supportedlock>' +
'<D:lockdiscovery/>' +
'<D:getcontenttype>httpd/unix-directory</D:getcontenttype>' +
'</D:prop>' +
'<D:status>HTTP/1.1 200 OK</D:status>' +
'</D:propstat>' +
'</D:response>' +
'<D:response xmlns:lp2="http://apache.org/dav/props/" ' +
'xmlns:lp1="DAV:">' +
'<D:href>/uploads/' + shared.created_document_id + '</D:href>' +
'<D:propstat>' +
'<D:prop>' +
'<lp1:resourcetype/>' +
'<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>' +
'<lp1:getcontentlength>66</lp1:getcontentlength>' +
'<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT' +
'</lp1:getlastmodified>' +
'<lp1:getetag>"20529-42-4e6bb383d0d30"</lp1:getetag>' +
'<lp2:executable>F</lp2:executable>' +
'<D:supportedlock>' +
'<D:lockentry>' +
'<D:lockscope><D:exclusive/></D:lockscope>' +
'<D:locktype><D:write/></D:locktype>' +
'</D:lockentry>' +
'<D:lockentry>' +
'<D:lockscope><D:shared/></D:lockscope>' +
'<D:locktype><D:write/></D:locktype>' +
'</D:lockentry>' +
'</D:supportedlock>' +
'<D:lockdiscovery/>' +
'</D:prop>' +
'<D:status>HTTP/1.1 200 OK</D:status>' +
'</D:propstat>' +
'</D:response>' +
'<D:response xmlns:lp2="http://apache.org/dav/props/" ' +
'xmlns:lp1="DAV:">' +
'<D:href>/uploads/b</D:href>' +
'<D:propstat>' +
'<D:prop>' +
'<lp1:resourcetype/>' +
'<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>' +
'<lp1:getcontentlength>25</lp1:getcontentlength>' +
'<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT' +
'</lp1:getlastmodified>' +
'<lp1:getetag>"20da3-19-4e6bb383e5fbb"</lp1:getetag>' +
'<lp2:executable>F</lp2:executable>' +
'<D:supportedlock>' +
'<D:lockentry>' +
'<D:lockscope><D:exclusive/></D:lockscope>' +
'<D:locktype><D:write/></D:locktype>' +
'</D:lockentry>' +
'<D:lockentry>' +
'<D:lockscope><D:shared/></D:lockscope>' +
'<D:locktype><D:write/></D:locktype>' +
'</D:lockentry>' +
'</D:supportedlock>' +
'<D:lockdiscovery/>' +
'</D:prop>' +
'<D:status>HTTP/1.1 200 OK</D:status>' +
'</D:propstat>' +
'</D:response>' +
'</D:multistatus>'
]); // PROPFIND ]); // PROPFIND
return jio.allDocs(); return jio.allDocs();
} }
...@@ -279,7 +196,7 @@ ...@@ -279,7 +196,7 @@
function listEmptyStorage() { function listEmptyStorage() {
responses.push([ responses.push([
207, 200,
{"Content-Type": "text/xml"}, {"Content-Type": "text/xml"},
'<?xml version="1.0" encoding="utf-8"?>' + '<?xml version="1.0" encoding="utf-8"?>' +
'<D:multistatus xmlns:D="DAV:">' + '<D:multistatus xmlns:D="DAV:">' +
...@@ -925,14 +842,16 @@ ...@@ -925,14 +842,16 @@
then(getCreatedDocument).then(getCreatedDocumentTest). then(getCreatedDocument).then(getCreatedDocumentTest).
// post b 201 // post b 201
then(postSpecificDocument).then(postSpecificDocumentTest). then(postSpecificDocument).then(postSpecificDocumentTest).
//postSpecificDocument().then(postSpecificDocumentTest).
// allD 200 2 documents // allD 200 2 documents
//then(listDocuments).then(list2DocumentsTest). then(listDocuments).then(list2DocumentsTest).
//listDocuments().then(list2DocumentsTest).
// remove a 204 // remove a 204
then(removeCreatedDocument).then(removeCreatedDocumentTest). then(removeCreatedDocument).then(removeCreatedDocumentTest).
// remove b 204 // remove b 204
then(removeSpecificDocument).then(removeSpecificDocumentTest). then(removeSpecificDocument).then(removeSpecificDocumentTest).
// allD 200 empty storage // allD 200 empty storage
//then(listEmptyStorage).then(listEmptyStorageTest). then(listEmptyStorage).then(listEmptyStorageTest).
// # Create and update documents, and some attachment and remove them // # Create and update documents, and some attachment and remove them
// put 201 // put 201
then(putNewDocument).then(putNewDocumentTest). then(putNewDocument).then(putNewDocumentTest).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment