Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
138
Merge Requests
138
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
4472f0ee
Commit
4472f0ee
authored
Mar 23, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Update jIO.
This allow to get localstorage compatibility with binary files.
parent
0831fb4a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
11 deletions
+44
-11
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
...nderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
+44
-11
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
View file @
4472f0ee
...
...
@@ -5633,13 +5633,13 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
\n
\n
\n
function
readBlobAsText(blob)
{\n
function
readBlobAsText(blob
,
encoding
)
{\n
var
fr =
new
FileReader();\n
return
new
RSVP.Promise(function
(resolve,
reject,
notify)
{\n
fr.addEventListener("load",
resolve);\n
fr.addEventListener("error",
reject);\n
fr.addEventListener("progress",
notify);\n
fr.readAsText(blob);\n
fr.readAsText(blob
,
encoding
);\n
},
function
()
{\n
fr.abort();\n
});\n
...
...
@@ -5658,6 +5658,19 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
});\n
}\n
util.readBlobAsArrayBuffer =
readBlobAsArrayBuffer;\n
\n
function
readBlobAsDataURL(blob)
{\n
var
fr =
new
FileReader();\n
return
new
RSVP.Promise(function
(resolve,
reject,
notify)
{\n
fr.addEventListener("load",
resolve);\n
fr.addEventListener("error",
reject);\n
fr.addEventListener("progress",
notify);\n
fr.readAsDataURL(blob);\n
},
function
()
{\n
fr.abort();\n
});\n
}\n
util.readBlobAsDataURL =
readBlobAsDataURL;\n
\n
\n
\n
...
...
@@ -5808,7 +5821,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
if
(!(param._blob
instanceof
Blob)
&&\n
typeof
param._data =
==
\'string\')
{\n
param._blob =
new
Blob([param._data],
{\n
"type":
param._content_type
||
param._mimetype
||
""\n
"type":
param._content_type
||
param._mimetype
||
"
text/plain;
charset=
utf-8
"\n
});\n
delete
param._data;\n
delete
param._mimetype;\n
...
...
@@ -6122,8 +6135,9 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
*
http://www.gnu.org/licenses/lgpl.html\n
*/\n
\n
/*jslint
nomen:
true
*/\n
/*global
jIO,
sessionStorage,
localStorage,
Blob,
RSVP
*/\n
/*jslint
nomen:
true*/\n
/*global
jIO,
sessionStorage,
localStorage,
Blob,
RSVP,
atob,\n
ArrayBuffer,
Uint8Array*/\n
\n
/**\n
*
JIO
Local
Storage.
Type =
\'local\'.\n
...
...
@@ -6139,7 +6153,8 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
*
@class
LocalStorage\n
*/\n
\n
(function
(jIO,
sessionStorage,
localStorage,
Blob,
RSVP)
{\n
(function
(jIO,
sessionStorage,
localStorage,
Blob,
RSVP,\n
atob,
ArrayBuffer,
Uint8Array)
{\n
"use
strict";\n
\n
function
LocalStorage(spec)
{\n
...
...
@@ -6176,6 +6191,23 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
}\n
return
doc;\n
};\n
\n
//
https://gist.github.com/davoclavo/4424731\n
function
dataURItoBlob(dataURI)
{\n
//
convert
base64
to
raw
binary
data
held
in
a
string\n
var
byteString =
atob(dataURI.split(\',\')[1]),\n
//
separate
out
the
mime
component\n
mimeString =
dataURI.split(\',\')[0].split(\':\')[1],\n
//
write
the
bytes
of
the
string
to
an
ArrayBuffer\n
arrayBuffer =
new
ArrayBuffer(byteString.length),\n
_ia =
new
Uint8Array(arrayBuffer),\n
i;\n
mimeString =
mimeString.slice(0,
mimeString.length
-
";base64".length);\n
for
(
i =
0;
i
<
byteString.length;
i
+=
1)
{\n
_ia[i]
=
byteString.charCodeAt(i);\n
}\n
return
new
Blob([arrayBuffer],
{type:
mimeString});\n
}\n
\n
LocalStorage.prototype.getAttachment =
function
(param)
{\n
restrictDocumentId(param._id);\n
...
...
@@ -6188,7 +6220,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
404\n
);\n
}\n
return
{data:
new
Blob([textstring]
)};\n
return
{data:
dataURItoBlob(textstring
)};\n
};\n
\n
LocalStorage.prototype.putAttachment =
function
(param)
{\n
...
...
@@ -6199,7 +6231,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
//
download
data\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
jIO.util.readBlobAs
Text
(param._blob);\n
return
jIO.util.readBlobAs
DataURL
(param._blob);\n
})\n
.push(function
(e)
{\n
context._storage.setItem(param._attachment,
e.target.result);\n
...
...
@@ -6225,7 +6257,8 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
\n
jIO.addStorage(\'local\',
LocalStorage);\n
\n
}(jIO,
sessionStorage,
localStorage,
Blob,
RSVP));\n
}(jIO,
sessionStorage,
localStorage,
Blob,
RSVP,\n
atob,
ArrayBuffer,
Uint8Array));\n
;/*\n
*
Copyright
2013,
Nexedi
SA\n
*
Released
under
the
LGPL
license.\n
...
...
@@ -8064,7 +8097,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
941.
36973.18728.63624
</string>
</value>
<value>
<string>
941.
55610.36294.45499
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -8082,7 +8115,7 @@ Query.searchTextToRegExp = searchTextToRegExp;\n
</tuple>
<state>
<tuple>
<float>
142
6154290.54
</float>
<float>
142
7118780.26
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
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