Commit 1c2f03a3 authored by Boris Kocherov's avatar Boris Kocherov

update zipfilestorage-with-jszip.js

parent 21583f45
......@@ -139,6 +139,26 @@ for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2
});
};
ZipFileStorage.prototype.hasCapacity = function (name) {
return (name === "list");
};
ZipFileStorage.prototype.buildQuery = function () {
return loadZip(this)
.push(function (zip) {
var dirname,
dir_list = [{id: '/', value: {}}];
for (dirname in zip.files) {
if (zip.files.hasOwnProperty(dirname)) {
if (zip.files[dirname].dir) {
dir_list.push({id: '/' + dirname, value: {}});
}
}
}
return dir_list;
});
};
ZipFileStorage.prototype.allAttachments = function (id) {
id = restrictDocumentId(id);
return loadZip(this)
......@@ -204,8 +224,8 @@ for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2
throw new jIO.util.jIOError("Cannot find document", 404);
}
if (!(zip.files.hasOwnProperty(attachId) && !zip.files[attachId].dir)) {
throw new jIO.util.jIOError("Cannot find attachment: "
+ '/' + id + " , " + name,
throw new jIO.util.jIOError("Cannot find attachment: " +
'/' + id + " , " + name,
404);
}
return zip.file(attachId).async('blob');
......@@ -222,8 +242,8 @@ for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2
throw new jIO.util.jIOError("Cannot find document", 404);
}
if (!(zip.files.hasOwnProperty(attachId) && !zip.files[attachId].dir)) {
throw new jIO.util.jIOError("Cannot find attachment: "
+ '/' + id + " , " + name,
throw new jIO.util.jIOError("Cannot find attachment: " +
'/' + id + " , " + name,
404);
}
zip.remove(attachId);
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.14254.57744.3293</string> </value>
<value> <string>968.64417.14775.57582</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1498139912.86</float>
<float>1531915725.03</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -139,6 +139,26 @@ for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2
});
};
ZipFileStorage.prototype.hasCapacity = function (name) {
return (name === "list");
};
ZipFileStorage.prototype.buildQuery = function () {
return loadZip(this)
.push(function (zip) {
var dirname,
dir_list = [{id: '/', value: {}}];
for (dirname in zip.files) {
if (zip.files.hasOwnProperty(dirname)) {
if (zip.files[dirname].dir) {
dir_list.push({id: '/' + dirname, value: {}});
}
}
}
return dir_list;
});
};
ZipFileStorage.prototype.allAttachments = function (id) {
id = restrictDocumentId(id);
return loadZip(this)
......@@ -204,8 +224,8 @@ for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2
throw new jIO.util.jIOError("Cannot find document", 404);
}
if (!(zip.files.hasOwnProperty(attachId) && !zip.files[attachId].dir)) {
throw new jIO.util.jIOError("Cannot find attachment: "
+ '/' + id + " , " + name,
throw new jIO.util.jIOError("Cannot find attachment: " +
'/' + id + " , " + name,
404);
}
return zip.file(attachId).async('blob');
......@@ -222,8 +242,8 @@ for(d=1;d<=W;d++)f[d]=g=g+c[d-1]<<1;for(e=0;e<=b;e++){var h=a[2*e+1];0!==h&&(a[2
throw new jIO.util.jIOError("Cannot find document", 404);
}
if (!(zip.files.hasOwnProperty(attachId) && !zip.files[attachId].dir)) {
throw new jIO.util.jIOError("Cannot find attachment: "
+ '/' + id + " , " + name,
throw new jIO.util.jIOError("Cannot find attachment: " +
'/' + id + " , " + name,
404);
}
zip.remove(attachId);
......
......@@ -6,13 +6,17 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>zipfilestorage-with-jszip.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
<value> <string>text/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
......@@ -20,7 +24,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>zipfilestorage-with-jszip.js</string> </value>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
......
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